powComplex, real part

Percentage Accurate: 41.2% → 79.4%
Time: 16.5s
Alternatives: 16
Speedup: 3.3×

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 16 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: 41.2% 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: 79.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
t_1 := e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;y.re \leq -29000000:\\
\;\;\;\;\cos t\_0 \cdot t\_1\\

\mathbf{elif}\;y.re \leq 3.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{\frac{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}}}\\

\mathbf{else}:\\
\;\;\;\;\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -2.9e7

    1. Initial program 39.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. Add Preprocessing
    3. Taylor expanded in y.im around 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 \cos \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
      3. lower-atan2.f6486.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 \cos \left(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
    5. Applied rewrites86.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 \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]

    if -2.9e7 < y.re < 3.8000000000000002e-15

    1. Initial program 39.8%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{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. *-commutativeN/A

        \[\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}} \]
      3. lift-exp.f64N/A

        \[\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}{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}} \]
      4. lift--.f64N/A

        \[\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 e^{\color{blue}{\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}} \]
      5. exp-diffN/A

        \[\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}}} \]
      6. associate-*r/N/A

        \[\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}}} \]
      7. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\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}}}} \]
    4. Applied rewrites81.9%

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

    if 3.8000000000000002e-15 < y.re

    1. Initial program 34.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. Add Preprocessing
    3. Taylor expanded in y.im around inf

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

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

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

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

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

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right) \cdot y.im\right) \]
      7. lower-hypot.f6471.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 \cos \left(\log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)} \cdot y.im\right) \]
    5. Applied rewrites71.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 \cos \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -29000000:\\ \;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{elif}\;y.re \leq 3.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{1}{\frac{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}}}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\
t_1 := e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;y.re \leq -0.08:\\
\;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot t\_1\\

\mathbf{elif}\;y.re \leq 3.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{\frac{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}{t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}}}\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -0.0800000000000000017

    1. Initial program 39.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. Add Preprocessing
    3. Taylor expanded in y.im around 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 \cos \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
      3. lower-atan2.f6486.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 \cos \left(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
    5. Applied rewrites86.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 \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]

    if -0.0800000000000000017 < y.re < 3.8000000000000002e-15

    1. Initial program 39.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{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. *-commutativeN/A

        \[\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}} \]
      3. lift-exp.f64N/A

        \[\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}{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}} \]
      4. lift--.f64N/A

        \[\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 e^{\color{blue}{\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}} \]
      5. exp-diffN/A

        \[\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}}} \]
      6. associate-*r/N/A

        \[\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}}} \]
      7. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\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}}}} \]
    4. Applied rewrites81.6%

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

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

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

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

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

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

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

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

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

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

    if 3.8000000000000002e-15 < y.re

    1. Initial program 34.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. Add Preprocessing
    3. Taylor expanded in y.im around inf

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

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

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

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

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

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right) \cdot y.im\right) \]
      7. lower-hypot.f6471.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 \cos \left(\log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)} \cdot y.im\right) \]
    5. Applied rewrites71.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 \cos \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.7%

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

Alternative 3: 77.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;y.re \leq -2.3 \cdot 10^{-32}:\\ \;\;\;\;\frac{1}{\frac{1}{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}}}\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-12}:\\ \;\;\;\;\cos t\_0 \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (atan2 x.im x.re) y.re)))
   (if (<= y.re -2.3e-32)
     (/
      1.0
      (/
       1.0
       (*
        (cos (fma y.im (log (hypot x.im x.re)) t_0))
        (pow (hypot x.im x.re) y.re))))
     (if (<= y.re 1.6e-12)
       (* (cos t_0) (exp (* (- y.im) (atan2 x.im x.re))))
       (*
        (cos (* (log (hypot x.re x.im)) y.im))
        (exp
         (-
          (* (log (sqrt (+ (* x.im x.im) (* x.re x.re)))) y.re)
          (* 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) {
	double t_0 = atan2(x_46_im, x_46_re) * y_46_re;
	double tmp;
	if (y_46_re <= -2.3e-32) {
		tmp = 1.0 / (1.0 / (cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0)) * pow(hypot(x_46_im, x_46_re), y_46_re)));
	} else if (y_46_re <= 1.6e-12) {
		tmp = cos(t_0) * exp((-y_46_im * atan2(x_46_im, x_46_re)));
	} else {
		tmp = cos((log(hypot(x_46_re, x_46_im)) * y_46_im)) * exp(((log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))) * y_46_re) - (y_46_im * atan2(x_46_im, x_46_re))));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(atan(x_46_im, x_46_re) * y_46_re)
	tmp = 0.0
	if (y_46_re <= -2.3e-32)
		tmp = Float64(1.0 / Float64(1.0 / Float64(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0)) * (hypot(x_46_im, x_46_re) ^ y_46_re))));
	elseif (y_46_re <= 1.6e-12)
		tmp = Float64(cos(t_0) * exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))));
	else
		tmp = Float64(cos(Float64(log(hypot(x_46_re, x_46_im)) * y_46_im)) * exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)))) * y_46_re) - Float64(y_46_im * atan(x_46_im, x_46_re)))));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -2.3e-32], N[(1.0 / N[(1.0 / N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.6e-12], N[(N[Cos[t$95$0], $MachinePrecision] * N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
\mathbf{if}\;y.re \leq -2.3 \cdot 10^{-32}:\\
\;\;\;\;\frac{1}{\frac{1}{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}}}\\

\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-12}:\\
\;\;\;\;\cos t\_0 \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

\mathbf{else}:\\
\;\;\;\;\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -2.3000000000000001e-32

    1. Initial program 38.9%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{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. *-commutativeN/A

        \[\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}} \]
      3. lift-exp.f64N/A

        \[\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}{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}} \]
      4. lift--.f64N/A

        \[\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 e^{\color{blue}{\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}} \]
      5. exp-diffN/A

        \[\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}}} \]
      6. associate-*r/N/A

        \[\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}}} \]
      7. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\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}}}} \]
    4. Applied rewrites67.2%

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

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

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

      if -2.3000000000000001e-32 < y.re < 1.6e-12

      1. Initial program 40.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. Add Preprocessing
      3. Taylor expanded in x.im around inf

        \[\leadsto e^{\log \left(\sqrt{\color{blue}{{x.im}^{2}}}\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) \]
      4. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto e^{\log \left(\sqrt{\color{blue}{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. lower-*.f6430.6

          \[\leadsto e^{\log \left(\sqrt{\color{blue}{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) \]
      5. Applied rewrites30.6%

        \[\leadsto e^{\log \left(\sqrt{\color{blue}{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) \]
      6. Taylor expanded in y.im around 0

        \[\leadsto e^{\log \left(\sqrt{x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

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

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

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

        \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
      10. Step-by-step derivation
        1. neg-mul-1N/A

          \[\leadsto e^{\color{blue}{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
        2. distribute-lft-neg-inN/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
        3. lower-*.f64N/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
        4. lower-neg.f64N/A

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

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

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

      if 1.6e-12 < y.re

      1. Initial program 34.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. Add Preprocessing
      3. Taylor expanded in y.im around inf

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 77.9% accurate, 1.0× speedup?

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

      1. Initial program 39.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. Add Preprocessing
      3. Taylor expanded in y.im around 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 \cos \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        3. lower-atan2.f6486.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 \cos \left(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
      5. Applied rewrites86.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 \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]

      if -0.068000000000000005 < y.re < 1.02e17

      1. Initial program 39.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. Add Preprocessing
      3. Taylor expanded in y.im around inf

        \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      4. Step-by-step derivation
        1. associate-*r*N/A

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

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

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

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

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

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

        \[\leadsto e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

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

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

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

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

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

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

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

      if 1.02e17 < y.re

      1. Initial program 33.3%

        \[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. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{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. *-commutativeN/A

          \[\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}} \]
        3. lift-exp.f64N/A

          \[\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}{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}} \]
        4. lift--.f64N/A

          \[\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 e^{\color{blue}{\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}} \]
        5. exp-diffN/A

          \[\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}}} \]
        6. associate-*r/N/A

          \[\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}}} \]
        7. clear-numN/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\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}}}} \]
      4. Applied rewrites50.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{1 + y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}{{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)}} \]
      9. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -0.068:\\ \;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{elif}\;y.re \leq 1.02 \cdot 10^{+17}:\\ \;\;\;\;\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(y.im, \tan^{-1}_* \frac{x.im}{x.re}, 1\right)}{\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 78.3% accurate, 1.2× speedup?

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

      1. Initial program 39.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. Add Preprocessing
      3. Taylor expanded in y.im around 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 \cos \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        3. lower-atan2.f6486.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 \cos \left(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
      5. Applied rewrites86.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 \cos \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]

      if -0.068000000000000005 < y.re < 1.02e17

      1. Initial program 39.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. Add Preprocessing
      3. Taylor expanded in y.im around inf

        \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      4. Step-by-step derivation
        1. associate-*r*N/A

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

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

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

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

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

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

        \[\leadsto e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

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

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

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

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

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

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

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

      if 1.02e17 < y.re

      1. Initial program 33.3%

        \[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. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{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. *-commutativeN/A

          \[\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}} \]
        3. lift-exp.f64N/A

          \[\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}{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}} \]
        4. lift--.f64N/A

          \[\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 e^{\color{blue}{\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}} \]
        5. exp-diffN/A

          \[\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}}} \]
        6. associate-*r/N/A

          \[\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}}} \]
        7. clear-numN/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\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}}}} \]
      4. Applied rewrites50.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{1}}{{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)}} \]
      9. Step-by-step derivation
        1. Applied rewrites66.8%

          \[\leadsto \frac{1}{\frac{\color{blue}{1}}{{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)}} \]
      10. Recombined 3 regimes into one program.
      11. Final simplification78.4%

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

      Alternative 6: 77.4% accurate, 1.2× speedup?

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

        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. Add Preprocessing
        3. Taylor expanded in y.im around 0

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

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

            \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
          3. lower-pow.f64N/A

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

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

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

            \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
          7. lower-hypot.f64N/A

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

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

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

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

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

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

        if -8.00000000000000038e-4 < y.re < 1.02e17

        1. Initial program 40.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. Add Preprocessing
        3. Taylor expanded in y.im around inf

          \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. Step-by-step derivation
          1. associate-*r*N/A

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

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

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

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

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

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

          \[\leadsto e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

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

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

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

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

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

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

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

        if 1.02e17 < y.re

        1. Initial program 33.3%

          \[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. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{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. *-commutativeN/A

            \[\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}} \]
          3. lift-exp.f64N/A

            \[\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}{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}} \]
          4. lift--.f64N/A

            \[\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 e^{\color{blue}{\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}} \]
          5. exp-diffN/A

            \[\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}}} \]
          6. associate-*r/N/A

            \[\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}}} \]
          7. clear-numN/A

            \[\leadsto \color{blue}{\frac{1}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\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}}}} \]
        4. Applied rewrites50.0%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1}{\frac{\color{blue}{1}}{{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)}} \]
        9. Step-by-step derivation
          1. Applied rewrites66.8%

            \[\leadsto \frac{1}{\frac{\color{blue}{1}}{{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)}} \]
        10. Recombined 3 regimes into one program.
        11. Final simplification78.4%

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

        Alternative 7: 75.3% accurate, 1.3× speedup?

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

          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. Add Preprocessing
          3. Taylor expanded in y.im around 0

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

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

              \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
            3. lower-pow.f64N/A

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

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

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

              \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
            7. lower-hypot.f64N/A

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

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

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

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

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

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

          if -8.00000000000000038e-4 < y.re < 1.35e81

          1. Initial program 39.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. Add Preprocessing
          3. Taylor expanded in y.im around inf

            \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
          4. Step-by-step derivation
            1. associate-*r*N/A

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

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

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

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

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

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

            \[\leadsto e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
          7. Step-by-step derivation
            1. lower-*.f64N/A

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

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

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

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

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

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

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

          if 1.35e81 < y.re

          1. Initial program 32.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. Add Preprocessing
          3. Taylor expanded in y.im around 0

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

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

              \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
            3. lower-pow.f64N/A

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

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

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

              \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
            7. lower-hypot.f64N/A

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

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

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

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

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

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

            \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
          7. Step-by-step derivation
            1. Applied rewrites71.5%

              \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
          8. Recombined 3 regimes into one program.
          9. Final simplification78.0%

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

          Alternative 8: 74.1% accurate, 1.6× speedup?

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

            1. Initial program 38.9%

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

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

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

                \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
              3. lower-pow.f64N/A

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

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

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

                \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
              7. lower-hypot.f64N/A

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

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

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

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

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

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

            if -2.3000000000000001e-32 < y.re < 1.35e81

            1. Initial program 39.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. Add Preprocessing
            3. Taylor expanded in x.im around inf

              \[\leadsto e^{\log \left(\sqrt{\color{blue}{{x.im}^{2}}}\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) \]
            4. Step-by-step derivation
              1. unpow2N/A

                \[\leadsto e^{\log \left(\sqrt{\color{blue}{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. lower-*.f6429.7

                \[\leadsto e^{\log \left(\sqrt{\color{blue}{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) \]
            5. Applied rewrites29.7%

              \[\leadsto e^{\log \left(\sqrt{\color{blue}{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) \]
            6. Taylor expanded in y.im around 0

              \[\leadsto e^{\log \left(\sqrt{x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
            7. Step-by-step derivation
              1. lower-*.f64N/A

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

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

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

              \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
            10. Step-by-step derivation
              1. neg-mul-1N/A

                \[\leadsto e^{\color{blue}{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
              2. distribute-lft-neg-inN/A

                \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
              3. lower-*.f64N/A

                \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
              4. lower-neg.f64N/A

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

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

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

            if 1.35e81 < y.re

            1. Initial program 32.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. Add Preprocessing
            3. Taylor expanded in y.im around 0

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

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

                \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
              3. lower-pow.f64N/A

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

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

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

                \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
              7. lower-hypot.f64N/A

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

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

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

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

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

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

              \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
            7. Step-by-step derivation
              1. Applied rewrites71.5%

                \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
            8. Recombined 3 regimes into one program.
            9. Final simplification77.3%

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

            Alternative 9: 61.3% accurate, 1.6× speedup?

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

              1. Initial program 36.3%

                \[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. Add Preprocessing
              3. Taylor expanded in y.im around 0

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

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

                  \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                3. lower-pow.f64N/A

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

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

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

                  \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                7. lower-hypot.f64N/A

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

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

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

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

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

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

                \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
              7. Step-by-step derivation
                1. Applied rewrites61.2%

                  \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]

                if 1.0000000000000001e-208 < x.re

                1. Initial program 40.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. Add Preprocessing
                3. Taylor expanded in y.im around 0

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

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

                    \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                  3. lower-pow.f64N/A

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

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

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

                    \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                  7. lower-hypot.f64N/A

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

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

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

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

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

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

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

              Alternative 10: 61.7% accurate, 2.0× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq 1.6 \cdot 10^{+237}:\\ \;\;\;\;1 \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x.im \cdot x.im}{x.re} \cdot 0.5\right)}^{y.re} \cdot \cos \left(\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
               (if (<= y.im 1.6e+237)
                 (* 1.0 (pow (hypot x.re x.im) y.re))
                 (*
                  (pow (* (/ (* x.im x.im) x.re) 0.5) y.re)
                  (cos (* (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 tmp;
              	if (y_46_im <= 1.6e+237) {
              		tmp = 1.0 * pow(hypot(x_46_re, x_46_im), y_46_re);
              	} else {
              		tmp = pow((((x_46_im * x_46_im) / x_46_re) * 0.5), y_46_re) * cos((atan2(x_46_im, x_46_re) * 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 tmp;
              	if (y_46_im <= 1.6e+237) {
              		tmp = 1.0 * Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
              	} else {
              		tmp = Math.pow((((x_46_im * x_46_im) / x_46_re) * 0.5), y_46_re) * Math.cos((Math.atan2(x_46_im, x_46_re) * y_46_re));
              	}
              	return tmp;
              }
              
              def code(x_46_re, x_46_im, y_46_re, y_46_im):
              	tmp = 0
              	if y_46_im <= 1.6e+237:
              		tmp = 1.0 * math.pow(math.hypot(x_46_re, x_46_im), y_46_re)
              	else:
              		tmp = math.pow((((x_46_im * x_46_im) / x_46_re) * 0.5), y_46_re) * math.cos((math.atan2(x_46_im, x_46_re) * y_46_re))
              	return tmp
              
              function code(x_46_re, x_46_im, y_46_re, y_46_im)
              	tmp = 0.0
              	if (y_46_im <= 1.6e+237)
              		tmp = Float64(1.0 * (hypot(x_46_re, x_46_im) ^ y_46_re));
              	else
              		tmp = Float64((Float64(Float64(Float64(x_46_im * x_46_im) / x_46_re) * 0.5) ^ y_46_re) * cos(Float64(atan(x_46_im, x_46_re) * y_46_re)));
              	end
              	return tmp
              end
              
              function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
              	tmp = 0.0;
              	if (y_46_im <= 1.6e+237)
              		tmp = 1.0 * (hypot(x_46_re, x_46_im) ^ y_46_re);
              	else
              		tmp = ((((x_46_im * x_46_im) / x_46_re) * 0.5) ^ y_46_re) * cos((atan2(x_46_im, x_46_re) * y_46_re));
              	end
              	tmp_2 = tmp;
              end
              
              code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, 1.6e+237], N[(1.0 * N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision] * 0.5), $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y.im \leq 1.6 \cdot 10^{+237}:\\
              \;\;\;\;1 \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
              
              \mathbf{else}:\\
              \;\;\;\;{\left(\frac{x.im \cdot x.im}{x.re} \cdot 0.5\right)}^{y.re} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y.im < 1.60000000000000009e237

                1. Initial program 38.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. Add Preprocessing
                3. Taylor expanded in y.im around 0

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

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

                    \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                  3. lower-pow.f64N/A

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

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

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

                    \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                  7. lower-hypot.f64N/A

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

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

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

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

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

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

                  \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
                7. Step-by-step derivation
                  1. Applied rewrites63.4%

                    \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]

                  if 1.60000000000000009e237 < y.im

                  1. Initial program 30.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. Add Preprocessing
                  3. Taylor expanded in y.im around 0

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

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

                      \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                    3. lower-pow.f64N/A

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

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

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

                      \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                    7. lower-hypot.f64N/A

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

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

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

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

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

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

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

                      \[\leadsto {\left(x.re \cdot \mathsf{fma}\left(\frac{0.5}{x.re}, \frac{x.im \cdot x.im}{x.re}, 1\right)\right)}^{y.re} \cdot \cos \left(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
                    2. Taylor expanded in x.im around inf

                      \[\leadsto {\left(\frac{1}{2} \cdot \frac{{x.im}^{2}}{x.re}\right)}^{y.re} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{\color{blue}{x.re}} \cdot y.re\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites53.7%

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq 1.6 \cdot 10^{+237}:\\ \;\;\;\;1 \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x.im \cdot x.im}{x.re} \cdot 0.5\right)}^{y.re} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \end{array} \]
                    6. Add Preprocessing

                    Alternative 11: 61.7% accurate, 3.3× speedup?

                    \[\begin{array}{l} \\ 1 \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \end{array} \]
                    (FPCore (x.re x.im y.re y.im)
                     :precision binary64
                     (* 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) {
                    	return 1.0 * pow(hypot(x_46_re, x_46_im), y_46_re);
                    }
                    
                    public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                    	return 1.0 * Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
                    }
                    
                    def code(x_46_re, x_46_im, y_46_re, y_46_im):
                    	return 1.0 * math.pow(math.hypot(x_46_re, x_46_im), y_46_re)
                    
                    function code(x_46_re, x_46_im, y_46_re, y_46_im)
                    	return Float64(1.0 * (hypot(x_46_re, x_46_im) ^ y_46_re))
                    end
                    
                    function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
                    	tmp = 1.0 * (hypot(x_46_re, x_46_im) ^ y_46_re);
                    end
                    
                    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 * N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    1 \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}
                    \end{array}
                    
                    Derivation
                    1. Initial program 38.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. Add Preprocessing
                    3. Taylor expanded in y.im around 0

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

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

                        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                      3. lower-pow.f64N/A

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

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

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

                        \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                      7. lower-hypot.f64N/A

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

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

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

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

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

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

                      \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
                    7. Step-by-step derivation
                      1. Applied rewrites60.9%

                        \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot 1 \]
                      2. Final simplification60.9%

                        \[\leadsto 1 \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \]
                      3. Add Preprocessing

                      Alternative 12: 28.8% accurate, 4.3× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq 1.2 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{elif}\;y.re \leq 2.05 \cdot 10^{+108}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{x.re \cdot x.re}{x.im}, 1\right) \cdot \left(-x.im\right)\right), y.re, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, \log x.im \cdot y.re\right) + 1\\ \end{array} \end{array} \]
                      (FPCore (x.re x.im y.re y.im)
                       :precision binary64
                       (if (<= y.re 1.2e-13)
                         1.0
                         (if (<= y.re 2.05e+108)
                           (fma
                            (log (* (fma (/ 0.5 x.im) (/ (* x.re x.re) x.im) 1.0) (- x.im)))
                            y.re
                            1.0)
                           (+
                            (fma (/ 0.5 x.im) (/ (* (* x.re x.re) y.re) x.im) (* (log x.im) y.re))
                            1.0))))
                      double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                      	double tmp;
                      	if (y_46_re <= 1.2e-13) {
                      		tmp = 1.0;
                      	} else if (y_46_re <= 2.05e+108) {
                      		tmp = fma(log((fma((0.5 / x_46_im), ((x_46_re * x_46_re) / x_46_im), 1.0) * -x_46_im)), y_46_re, 1.0);
                      	} else {
                      		tmp = fma((0.5 / x_46_im), (((x_46_re * x_46_re) * y_46_re) / x_46_im), (log(x_46_im) * y_46_re)) + 1.0;
                      	}
                      	return tmp;
                      }
                      
                      function code(x_46_re, x_46_im, y_46_re, y_46_im)
                      	tmp = 0.0
                      	if (y_46_re <= 1.2e-13)
                      		tmp = 1.0;
                      	elseif (y_46_re <= 2.05e+108)
                      		tmp = fma(log(Float64(fma(Float64(0.5 / x_46_im), Float64(Float64(x_46_re * x_46_re) / x_46_im), 1.0) * Float64(-x_46_im))), y_46_re, 1.0);
                      	else
                      		tmp = Float64(fma(Float64(0.5 / x_46_im), Float64(Float64(Float64(x_46_re * x_46_re) * y_46_re) / x_46_im), Float64(log(x_46_im) * y_46_re)) + 1.0);
                      	end
                      	return tmp
                      end
                      
                      code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, 1.2e-13], 1.0, If[LessEqual[y$46$re, 2.05e+108], N[(N[Log[N[(N[(N[(0.5 / x$46$im), $MachinePrecision] * N[(N[(x$46$re * x$46$re), $MachinePrecision] / x$46$im), $MachinePrecision] + 1.0), $MachinePrecision] * (-x$46$im)), $MachinePrecision]], $MachinePrecision] * y$46$re + 1.0), $MachinePrecision], N[(N[(N[(0.5 / x$46$im), $MachinePrecision] * N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] * y$46$re), $MachinePrecision] / x$46$im), $MachinePrecision] + N[(N[Log[x$46$im], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;y.re \leq 1.2 \cdot 10^{-13}:\\
                      \;\;\;\;1\\
                      
                      \mathbf{elif}\;y.re \leq 2.05 \cdot 10^{+108}:\\
                      \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{x.re \cdot x.re}{x.im}, 1\right) \cdot \left(-x.im\right)\right), y.re, 1\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, \log x.im \cdot y.re\right) + 1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if y.re < 1.1999999999999999e-13

                        1. Initial program 39.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. Add Preprocessing
                        3. Taylor expanded in y.im around 0

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

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

                            \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                          3. lower-pow.f64N/A

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

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

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

                            \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                          7. lower-hypot.f64N/A

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

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

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

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

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

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

                          \[\leadsto 1 \]
                        7. Step-by-step derivation
                          1. Applied rewrites33.5%

                            \[\leadsto 1 \]

                          if 1.1999999999999999e-13 < y.re < 2.05e108

                          1. Initial program 35.3%

                            \[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. Add Preprocessing
                          3. Taylor expanded in y.im around 0

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

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

                              \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                            3. lower-pow.f64N/A

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

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

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

                              \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                            7. lower-hypot.f64N/A

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

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

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

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

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

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

                            \[\leadsto 1 \]
                          7. Step-by-step derivation
                            1. Applied rewrites2.5%

                              \[\leadsto 1 \]
                            2. Taylor expanded in y.re around 0

                              \[\leadsto 1 + \color{blue}{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \]
                            3. Step-by-step derivation
                              1. Applied rewrites2.7%

                                \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \color{blue}{y.re}, 1\right) \]
                              2. Taylor expanded in x.im around -inf

                                \[\leadsto \mathsf{fma}\left(\log \left(-1 \cdot \left(x.im \cdot \left(1 + \frac{1}{2} \cdot \frac{{x.re}^{2}}{{x.im}^{2}}\right)\right)\right), y.re, 1\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites27.3%

                                  \[\leadsto \mathsf{fma}\left(\log \left(\left(-x.im\right) \cdot \mathsf{fma}\left(\frac{0.5}{x.im}, \frac{x.re \cdot x.re}{x.im}, 1\right)\right), y.re, 1\right) \]

                                if 2.05e108 < y.re

                                1. Initial program 32.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. Add Preprocessing
                                3. Taylor expanded in y.im around 0

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

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

                                    \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                  3. lower-pow.f64N/A

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

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

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

                                    \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                  7. lower-hypot.f64N/A

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

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

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

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

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

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

                                  \[\leadsto 1 \]
                                7. Step-by-step derivation
                                  1. Applied rewrites2.5%

                                    \[\leadsto 1 \]
                                  2. Taylor expanded in y.re around 0

                                    \[\leadsto 1 + \color{blue}{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites3.5%

                                      \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \color{blue}{y.re}, 1\right) \]
                                    2. Taylor expanded in x.re around 0

                                      \[\leadsto 1 + \left(\frac{1}{2} \cdot \frac{{x.re}^{2} \cdot y.re}{{x.im}^{2}} + \color{blue}{y.re \cdot \log x.im}\right) \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites21.1%

                                        \[\leadsto \mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, y.re \cdot \log x.im\right) + 1 \]
                                    4. Recombined 3 regimes into one program.
                                    5. Final simplification30.8%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq 1.2 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{elif}\;y.re \leq 2.05 \cdot 10^{+108}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{x.re \cdot x.re}{x.im}, 1\right) \cdot \left(-x.im\right)\right), y.re, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, \log x.im \cdot y.re\right) + 1\\ \end{array} \]
                                    6. Add Preprocessing

                                    Alternative 13: 28.7% accurate, 4.4× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq 3.1 \cdot 10^{-14}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, \log x.im \cdot y.re\right) + 1\\ \end{array} \end{array} \]
                                    (FPCore (x.re x.im y.re y.im)
                                     :precision binary64
                                     (if (<= y.re 3.1e-14)
                                       1.0
                                       (+
                                        (fma (/ 0.5 x.im) (/ (* (* x.re x.re) y.re) x.im) (* (log x.im) y.re))
                                        1.0)))
                                    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                                    	double tmp;
                                    	if (y_46_re <= 3.1e-14) {
                                    		tmp = 1.0;
                                    	} else {
                                    		tmp = fma((0.5 / x_46_im), (((x_46_re * x_46_re) * y_46_re) / x_46_im), (log(x_46_im) * y_46_re)) + 1.0;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(x_46_re, x_46_im, y_46_re, y_46_im)
                                    	tmp = 0.0
                                    	if (y_46_re <= 3.1e-14)
                                    		tmp = 1.0;
                                    	else
                                    		tmp = Float64(fma(Float64(0.5 / x_46_im), Float64(Float64(Float64(x_46_re * x_46_re) * y_46_re) / x_46_im), Float64(log(x_46_im) * y_46_re)) + 1.0);
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, 3.1e-14], 1.0, N[(N[(N[(0.5 / x$46$im), $MachinePrecision] * N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] * y$46$re), $MachinePrecision] / x$46$im), $MachinePrecision] + N[(N[Log[x$46$im], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;y.re \leq 3.1 \cdot 10^{-14}:\\
                                    \;\;\;\;1\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, \log x.im \cdot y.re\right) + 1\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if y.re < 3.10000000000000004e-14

                                      1. Initial program 40.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. Add Preprocessing
                                      3. Taylor expanded in y.im around 0

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

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

                                          \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                        3. lower-pow.f64N/A

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

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

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

                                          \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                        7. lower-hypot.f64N/A

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

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

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

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

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

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

                                        \[\leadsto 1 \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites33.7%

                                          \[\leadsto 1 \]

                                        if 3.10000000000000004e-14 < y.re

                                        1. Initial program 33.3%

                                          \[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. Add Preprocessing
                                        3. Taylor expanded in y.im around 0

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

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

                                            \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                          3. lower-pow.f64N/A

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

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

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

                                            \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                          7. lower-hypot.f64N/A

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

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

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

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

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

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

                                          \[\leadsto 1 \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites2.5%

                                            \[\leadsto 1 \]
                                          2. Taylor expanded in y.re around 0

                                            \[\leadsto 1 + \color{blue}{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites3.1%

                                              \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \color{blue}{y.re}, 1\right) \]
                                            2. Taylor expanded in x.re around 0

                                              \[\leadsto 1 + \left(\frac{1}{2} \cdot \frac{{x.re}^{2} \cdot y.re}{{x.im}^{2}} + \color{blue}{y.re \cdot \log x.im}\right) \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites13.0%

                                                \[\leadsto \mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, y.re \cdot \log x.im\right) + 1 \]
                                            4. Recombined 2 regimes into one program.
                                            5. Final simplification27.6%

                                              \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq 3.1 \cdot 10^{-14}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{\left(x.re \cdot x.re\right) \cdot y.re}{x.im}, \log x.im \cdot y.re\right) + 1\\ \end{array} \]
                                            6. Add Preprocessing

                                            Alternative 14: 28.5% accurate, 4.7× speedup?

                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq 3.1 \cdot 10^{-14}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{x.re \cdot x.re}{x.im}, \log x.im\right), y.re, 1\right)\\ \end{array} \end{array} \]
                                            (FPCore (x.re x.im y.re y.im)
                                             :precision binary64
                                             (if (<= y.re 3.1e-14)
                                               1.0
                                               (fma (fma (/ 0.5 x.im) (/ (* x.re x.re) x.im) (log x.im)) y.re 1.0)))
                                            double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                                            	double tmp;
                                            	if (y_46_re <= 3.1e-14) {
                                            		tmp = 1.0;
                                            	} else {
                                            		tmp = fma(fma((0.5 / x_46_im), ((x_46_re * x_46_re) / x_46_im), log(x_46_im)), y_46_re, 1.0);
                                            	}
                                            	return tmp;
                                            }
                                            
                                            function code(x_46_re, x_46_im, y_46_re, y_46_im)
                                            	tmp = 0.0
                                            	if (y_46_re <= 3.1e-14)
                                            		tmp = 1.0;
                                            	else
                                            		tmp = fma(fma(Float64(0.5 / x_46_im), Float64(Float64(x_46_re * x_46_re) / x_46_im), log(x_46_im)), y_46_re, 1.0);
                                            	end
                                            	return tmp
                                            end
                                            
                                            code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, 3.1e-14], 1.0, N[(N[(N[(0.5 / x$46$im), $MachinePrecision] * N[(N[(x$46$re * x$46$re), $MachinePrecision] / x$46$im), $MachinePrecision] + N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] * y$46$re + 1.0), $MachinePrecision]]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \begin{array}{l}
                                            \mathbf{if}\;y.re \leq 3.1 \cdot 10^{-14}:\\
                                            \;\;\;\;1\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{x.re \cdot x.re}{x.im}, \log x.im\right), y.re, 1\right)\\
                                            
                                            
                                            \end{array}
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 2 regimes
                                            2. if y.re < 3.10000000000000004e-14

                                              1. Initial program 40.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. Add Preprocessing
                                              3. Taylor expanded in y.im around 0

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

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

                                                  \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                                3. lower-pow.f64N/A

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

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

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

                                                  \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                                7. lower-hypot.f64N/A

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

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

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

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

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

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

                                                \[\leadsto 1 \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites33.7%

                                                  \[\leadsto 1 \]

                                                if 3.10000000000000004e-14 < y.re

                                                1. Initial program 33.3%

                                                  \[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. Add Preprocessing
                                                3. Taylor expanded in y.im around 0

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

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

                                                    \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                                  3. lower-pow.f64N/A

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

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

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

                                                    \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                                  7. lower-hypot.f64N/A

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

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

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

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

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

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

                                                  \[\leadsto 1 \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites2.5%

                                                    \[\leadsto 1 \]
                                                  2. Taylor expanded in y.re around 0

                                                    \[\leadsto 1 + \color{blue}{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites3.1%

                                                      \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \color{blue}{y.re}, 1\right) \]
                                                    2. Taylor expanded in x.re around 0

                                                      \[\leadsto \mathsf{fma}\left(\log x.im + \frac{1}{2} \cdot \frac{{x.re}^{2}}{{x.im}^{2}}, y.re, 1\right) \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites11.7%

                                                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{0.5}{x.im}, \frac{x.re \cdot x.re}{x.im}, \log x.im\right), y.re, 1\right) \]
                                                    4. Recombined 2 regimes into one program.
                                                    5. Add Preprocessing

                                                    Alternative 15: 28.1% accurate, 5.0× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq 3.1 \cdot 10^{-14}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{fma}\left(0.5, \frac{x.re \cdot x.re}{x.im}, x.im\right)\right), y.re, 1\right)\\ \end{array} \end{array} \]
                                                    (FPCore (x.re x.im y.re y.im)
                                                     :precision binary64
                                                     (if (<= y.re 3.1e-14)
                                                       1.0
                                                       (fma (log (fma 0.5 (/ (* x.re x.re) x.im) x.im)) y.re 1.0)))
                                                    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                                                    	double tmp;
                                                    	if (y_46_re <= 3.1e-14) {
                                                    		tmp = 1.0;
                                                    	} else {
                                                    		tmp = fma(log(fma(0.5, ((x_46_re * x_46_re) / x_46_im), x_46_im)), y_46_re, 1.0);
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(x_46_re, x_46_im, y_46_re, y_46_im)
                                                    	tmp = 0.0
                                                    	if (y_46_re <= 3.1e-14)
                                                    		tmp = 1.0;
                                                    	else
                                                    		tmp = fma(log(fma(0.5, Float64(Float64(x_46_re * x_46_re) / x_46_im), x_46_im)), y_46_re, 1.0);
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, 3.1e-14], 1.0, N[(N[Log[N[(0.5 * N[(N[(x$46$re * x$46$re), $MachinePrecision] / x$46$im), $MachinePrecision] + x$46$im), $MachinePrecision]], $MachinePrecision] * y$46$re + 1.0), $MachinePrecision]]
                                                    
                                                    \begin{array}{l}
                                                    
                                                    \\
                                                    \begin{array}{l}
                                                    \mathbf{if}\;y.re \leq 3.1 \cdot 10^{-14}:\\
                                                    \;\;\;\;1\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{fma}\left(0.5, \frac{x.re \cdot x.re}{x.im}, x.im\right)\right), y.re, 1\right)\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 2 regimes
                                                    2. if y.re < 3.10000000000000004e-14

                                                      1. Initial program 40.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. Add Preprocessing
                                                      3. Taylor expanded in y.im around 0

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

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

                                                          \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                                        3. lower-pow.f64N/A

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

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

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

                                                          \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                                        7. lower-hypot.f64N/A

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

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

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

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

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

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

                                                        \[\leadsto 1 \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites33.7%

                                                          \[\leadsto 1 \]

                                                        if 3.10000000000000004e-14 < y.re

                                                        1. Initial program 33.3%

                                                          \[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. Add Preprocessing
                                                        3. Taylor expanded in y.im around 0

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

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

                                                            \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                                          3. lower-pow.f64N/A

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

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

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

                                                            \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                                          7. lower-hypot.f64N/A

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

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

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

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

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

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

                                                          \[\leadsto 1 \]
                                                        7. Step-by-step derivation
                                                          1. Applied rewrites2.5%

                                                            \[\leadsto 1 \]
                                                          2. Taylor expanded in y.re around 0

                                                            \[\leadsto 1 + \color{blue}{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites3.1%

                                                              \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \color{blue}{y.re}, 1\right) \]
                                                            2. Taylor expanded in x.re around 0

                                                              \[\leadsto \mathsf{fma}\left(\log \left(x.im + \frac{1}{2} \cdot \frac{{x.re}^{2}}{x.im}\right), y.re, 1\right) \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites9.2%

                                                                \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{fma}\left(0.5, \frac{x.re \cdot x.re}{x.im}, x.im\right)\right), y.re, 1\right) \]
                                                            4. Recombined 2 regimes into one program.
                                                            5. Add Preprocessing

                                                            Alternative 16: 26.2% accurate, 680.0× speedup?

                                                            \[\begin{array}{l} \\ 1 \end{array} \]
                                                            (FPCore (x.re x.im y.re y.im) :precision binary64 1.0)
                                                            double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                                                            	return 1.0;
                                                            }
                                                            
                                                            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 = 1.0d0
                                                            end function
                                                            
                                                            public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                                                            	return 1.0;
                                                            }
                                                            
                                                            def code(x_46_re, x_46_im, y_46_re, y_46_im):
                                                            	return 1.0
                                                            
                                                            function code(x_46_re, x_46_im, y_46_re, y_46_im)
                                                            	return 1.0
                                                            end
                                                            
                                                            function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
                                                            	tmp = 1.0;
                                                            end
                                                            
                                                            code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 1.0
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            1
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Initial program 38.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. Add Preprocessing
                                                            3. Taylor expanded in y.im around 0

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

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

                                                                \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                                              3. lower-pow.f64N/A

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

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

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

                                                                \[\leadsto {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                                                              7. lower-hypot.f64N/A

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

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

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

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

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

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

                                                              \[\leadsto 1 \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites24.6%

                                                                \[\leadsto 1 \]
                                                              2. Add Preprocessing

                                                              Reproduce

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