powComplex, real part

Percentage Accurate: 39.8% → 77.0%
Time: 17.8s
Alternatives: 9
Speedup: 4.9×

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 9 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: 39.8% accurate, 1.0× speedup?

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

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

Alternative 1: 77.0% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := 1 \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -1.3 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+22}:\\
\;\;\;\;e^{\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)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -1.30000000000000005e-6 or 3.8000000000000004e22 < y.re

    1. Initial program 30.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. lower-*.f64N/A

        \[\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}} \]
      2. lower-cos.f64N/A

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

        \[\leadsto \cos \color{blue}{\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. lower-atan2.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto 1 \cdot {\color{blue}{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}}^{y.re} \]
    7. Step-by-step derivation
      1. Applied rewrites75.0%

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

      if -1.30000000000000005e-6 < y.re < 3.8000000000000004e22

      1. Initial program 35.7%

        \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      2. 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. 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(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
        2. lower-atan2.f6449.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(y.re \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}}\right) \]
      5. Applied rewrites49.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(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      6. Taylor expanded in y.re around 0

        \[\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) \]
      7. 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(\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) \]
        5. lower-atan2.f6482.0

          \[\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) \]
      8. Applied rewrites82.0%

        \[\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) \]
    8. Recombined 2 regimes into one program.
    9. Add Preprocessing

    Alternative 2: 72.4% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := \log \left(\frac{-1}{x.re}\right)\\ t_3 := y.im \cdot \log x.re\\ t_4 := \sin t\_0 \cdot \sin t\_3\\ t_5 := \cos t\_0 \cdot \cos t\_3\\ \mathbf{if}\;x.re \leq -5 \cdot 10^{-309}:\\ \;\;\;\;\cos \left(\mathsf{fma}\left(t\_2, -y.im, t\_0\right)\right) \cdot e^{-\mathsf{fma}\left(y.re, t\_2, t\_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{{t\_5}^{3} - {t\_4}^{3}}{{t\_5}^{2} + \left({t\_4}^{2} + t\_5 \cdot t\_4\right)} \cdot e^{y.re \cdot \log x.re - t\_1}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (* y.re (atan2 x.im x.re)))
            (t_1 (* y.im (atan2 x.im x.re)))
            (t_2 (log (/ -1.0 x.re)))
            (t_3 (* y.im (log x.re)))
            (t_4 (* (sin t_0) (sin t_3)))
            (t_5 (* (cos t_0) (cos t_3))))
       (if (<= x.re -5e-309)
         (* (cos (fma t_2 (- y.im) t_0)) (exp (- (fma y.re t_2 t_1))))
         (*
          (/
           (- (pow t_5 3.0) (pow t_4 3.0))
           (+ (pow t_5 2.0) (+ (pow t_4 2.0) (* t_5 t_4))))
          (exp (- (* y.re (log x.re)) t_1))))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = y_46_re * atan2(x_46_im, x_46_re);
    	double t_1 = y_46_im * atan2(x_46_im, x_46_re);
    	double t_2 = log((-1.0 / x_46_re));
    	double t_3 = y_46_im * log(x_46_re);
    	double t_4 = sin(t_0) * sin(t_3);
    	double t_5 = cos(t_0) * cos(t_3);
    	double tmp;
    	if (x_46_re <= -5e-309) {
    		tmp = cos(fma(t_2, -y_46_im, t_0)) * exp(-fma(y_46_re, t_2, t_1));
    	} else {
    		tmp = ((pow(t_5, 3.0) - pow(t_4, 3.0)) / (pow(t_5, 2.0) + (pow(t_4, 2.0) + (t_5 * t_4)))) * exp(((y_46_re * log(x_46_re)) - t_1));
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(y_46_re * atan(x_46_im, x_46_re))
    	t_1 = Float64(y_46_im * atan(x_46_im, x_46_re))
    	t_2 = log(Float64(-1.0 / x_46_re))
    	t_3 = Float64(y_46_im * log(x_46_re))
    	t_4 = Float64(sin(t_0) * sin(t_3))
    	t_5 = Float64(cos(t_0) * cos(t_3))
    	tmp = 0.0
    	if (x_46_re <= -5e-309)
    		tmp = Float64(cos(fma(t_2, Float64(-y_46_im), t_0)) * exp(Float64(-fma(y_46_re, t_2, t_1))));
    	else
    		tmp = Float64(Float64(Float64((t_5 ^ 3.0) - (t_4 ^ 3.0)) / Float64((t_5 ^ 2.0) + Float64((t_4 ^ 2.0) + Float64(t_5 * t_4)))) * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_1)));
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sin[t$95$0], $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[t$95$0], $MachinePrecision] * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -5e-309], N[(N[Cos[N[(t$95$2 * (-y$46$im) + t$95$0), $MachinePrecision]], $MachinePrecision] * N[Exp[(-N[(y$46$re * t$95$2 + t$95$1), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[t$95$5, 3.0], $MachinePrecision] - N[Power[t$95$4, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[Power[t$95$5, 2.0], $MachinePrecision] + N[(N[Power[t$95$4, 2.0], $MachinePrecision] + N[(t$95$5 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
    t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
    t_2 := \log \left(\frac{-1}{x.re}\right)\\
    t_3 := y.im \cdot \log x.re\\
    t_4 := \sin t\_0 \cdot \sin t\_3\\
    t_5 := \cos t\_0 \cdot \cos t\_3\\
    \mathbf{if}\;x.re \leq -5 \cdot 10^{-309}:\\
    \;\;\;\;\cos \left(\mathsf{fma}\left(t\_2, -y.im, t\_0\right)\right) \cdot e^{-\mathsf{fma}\left(y.re, t\_2, t\_1\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{{t\_5}^{3} - {t\_4}^{3}}{{t\_5}^{2} + \left({t\_4}^{2} + t\_5 \cdot t\_4\right)} \cdot e^{y.re \cdot \log x.re - t\_1}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x.re < -4.9999999999999995e-309

      1. Initial program 32.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 x.re around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -4.9999999999999995e-309 < x.re

      1. Initial program 34.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 77.2% accurate, 2.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\ \mathbf{if}\;y.re \leq -1.3 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 820000000:\\ \;\;\;\;\frac{1}{\frac{1}{1 \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x.re x.im y.re y.im)
       :precision binary64
       (let* ((t_0 (* 1.0 (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re))))
         (if (<= y.re -1.3e-6)
           t_0
           (if (<= y.re 820000000.0)
             (/ 1.0 (/ 1.0 (* 1.0 (exp (* (- y.im) (atan2 x.im x.re))))))
             t_0))))
      double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
      	double t_0 = 1.0 * pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re);
      	double tmp;
      	if (y_46_re <= -1.3e-6) {
      		tmp = t_0;
      	} else if (y_46_re <= 820000000.0) {
      		tmp = 1.0 / (1.0 / (1.0 * exp((-y_46_im * atan2(x_46_im, x_46_re)))));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x_46_re, x_46_im, y_46_re, y_46_im)
      	t_0 = Float64(1.0 * (sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re))
      	tmp = 0.0
      	if (y_46_re <= -1.3e-6)
      		tmp = t_0;
      	elseif (y_46_re <= 820000000.0)
      		tmp = Float64(1.0 / Float64(1.0 / Float64(1.0 * exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))))));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(1.0 * N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.3e-6], t$95$0, If[LessEqual[y$46$re, 820000000.0], N[(1.0 / N[(1.0 / N[(1.0 * N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := 1 \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\
      \mathbf{if}\;y.re \leq -1.3 \cdot 10^{-6}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y.re \leq 820000000:\\
      \;\;\;\;\frac{1}{\frac{1}{1 \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}}}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y.re < -1.30000000000000005e-6 or 8.2e8 < y.re

        1. Initial program 30.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. lower-*.f64N/A

            \[\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}} \]
          2. lower-cos.f64N/A

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

            \[\leadsto \cos \color{blue}{\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. lower-atan2.f64N/A

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

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

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

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

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

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

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

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

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

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

          if -1.30000000000000005e-6 < y.re < 8.2e8

          1. Initial program 35.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. 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 rewrites35.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1}{\frac{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}{1}} \]
          9. Step-by-step derivation
            1. Applied rewrites82.8%

              \[\leadsto \frac{1}{\frac{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}{1}} \]
            2. Step-by-step derivation
              1. Applied rewrites82.8%

                \[\leadsto \frac{1}{\frac{1}{\color{blue}{1 \cdot e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}}} \]
            3. Recombined 2 regimes into one program.
            4. Final simplification78.6%

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

            Alternative 4: 77.2% accurate, 2.8× speedup?

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

              1. Initial program 30.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. lower-*.f64N/A

                  \[\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}} \]
                2. lower-cos.f64N/A

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

                  \[\leadsto \cos \color{blue}{\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. lower-atan2.f64N/A

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

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

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

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

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

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

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

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

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

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

                if -1.30000000000000005e-6 < y.re < 8.2e8

                1. Initial program 35.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. 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 rewrites35.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{1}{\frac{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}{1}} \]
                9. Step-by-step derivation
                  1. Applied rewrites82.8%

                    \[\leadsto \frac{1}{\frac{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}{1}} \]
                10. Recombined 2 regimes into one program.
                11. Add Preprocessing

                Alternative 5: 61.9% accurate, 4.9× speedup?

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

                  1. Initial program 30.4%

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

                      \[\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}} \]
                    2. lower-cos.f64N/A

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

                      \[\leadsto \cos \color{blue}{\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. lower-atan2.f64N/A

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

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

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

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

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

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

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

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

                    \[\leadsto 1 \cdot {\color{blue}{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}}^{y.re} \]
                  7. Step-by-step derivation
                    1. Applied rewrites72.8%

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

                    if -2.29999999999999996e-36 < y.re < 31

                    1. Initial program 35.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 rewrites35.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                    9. Step-by-step derivation
                      1. Applied rewrites50.7%

                        \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                      2. Step-by-step derivation
                        1. Applied rewrites50.7%

                          \[\leadsto \frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)} \]
                      3. Recombined 2 regimes into one program.
                      4. Add Preprocessing

                      Alternative 6: 47.3% accurate, 4.9× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 \cdot {\left(\frac{0.5 \cdot \left(x.im \cdot x.im\right)}{x.re}\right)}^{y.re}\\ \mathbf{if}\;y.re \leq -2.3 \cdot 10^{-36}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{-9}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                      (FPCore (x.re x.im y.re y.im)
                       :precision binary64
                       (let* ((t_0 (* 1.0 (pow (/ (* 0.5 (* x.im x.im)) x.re) y.re))))
                         (if (<= y.re -2.3e-36)
                           t_0
                           (if (<= y.re 1.75e-9) (/ 1.0 (fma (atan2 x.im x.re) y.im 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 = 1.0 * pow(((0.5 * (x_46_im * x_46_im)) / x_46_re), y_46_re);
                      	double tmp;
                      	if (y_46_re <= -2.3e-36) {
                      		tmp = t_0;
                      	} else if (y_46_re <= 1.75e-9) {
                      		tmp = 1.0 / fma(atan2(x_46_im, x_46_re), y_46_im, 1.0);
                      	} else {
                      		tmp = t_0;
                      	}
                      	return tmp;
                      }
                      
                      function code(x_46_re, x_46_im, y_46_re, y_46_im)
                      	t_0 = Float64(1.0 * (Float64(Float64(0.5 * Float64(x_46_im * x_46_im)) / x_46_re) ^ y_46_re))
                      	tmp = 0.0
                      	if (y_46_re <= -2.3e-36)
                      		tmp = t_0;
                      	elseif (y_46_re <= 1.75e-9)
                      		tmp = Float64(1.0 / fma(atan(x_46_im, x_46_re), y_46_im, 1.0));
                      	else
                      		tmp = t_0;
                      	end
                      	return tmp
                      end
                      
                      code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(1.0 * N[Power[N[(N[(0.5 * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / x$46$re), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.3e-36], t$95$0, If[LessEqual[y$46$re, 1.75e-9], N[(1.0 / N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := 1 \cdot {\left(\frac{0.5 \cdot \left(x.im \cdot x.im\right)}{x.re}\right)}^{y.re}\\
                      \mathbf{if}\;y.re \leq -2.3 \cdot 10^{-36}:\\
                      \;\;\;\;t\_0\\
                      
                      \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{-9}:\\
                      \;\;\;\;\frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_0\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if y.re < -2.29999999999999996e-36 or 1.75e-9 < y.re

                        1. Initial program 30.4%

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

                            \[\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}} \]
                          2. lower-cos.f64N/A

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

                            \[\leadsto \cos \color{blue}{\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. lower-atan2.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto 1 \cdot {\color{blue}{\left(\frac{0.5 \cdot \left(x.im \cdot x.im\right)}{x.re}\right)}}^{y.re} \]

                              if -2.29999999999999996e-36 < y.re < 1.75e-9

                              1. Initial program 36.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. 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 rewrites35.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                              9. Step-by-step derivation
                                1. Applied rewrites51.9%

                                  \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                                2. Step-by-step derivation
                                  1. Applied rewrites51.9%

                                    \[\leadsto \frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)} \]
                                3. Recombined 2 regimes into one program.
                                4. Add Preprocessing

                                Alternative 7: 32.6% accurate, 5.1× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq 1.02 \cdot 10^{+21}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y.re, \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right), 1\right)\\ \end{array} \end{array} \]
                                (FPCore (x.re x.im y.re y.im)
                                 :precision binary64
                                 (if (<= y.re 1.02e+21)
                                   (/ 1.0 (fma (atan2 x.im x.re) y.im 1.0))
                                   (fma y.re (log (sqrt (fma x.im x.im (* x.re x.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.02e+21) {
                                		tmp = 1.0 / fma(atan2(x_46_im, x_46_re), y_46_im, 1.0);
                                	} else {
                                		tmp = fma(y_46_re, log(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_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.02e+21)
                                		tmp = Float64(1.0 / fma(atan(x_46_im, x_46_re), y_46_im, 1.0));
                                	else
                                		tmp = fma(y_46_re, log(sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_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.02e+21], N[(1.0 / N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im + 1.0), $MachinePrecision]), $MachinePrecision], N[(y$46$re * N[Log[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;y.re \leq 1.02 \cdot 10^{+21}:\\
                                \;\;\;\;\frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\mathsf{fma}\left(y.re, \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right), 1\right)\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if y.re < 1.02e21

                                  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. 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 rewrites33.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                                  9. Step-by-step derivation
                                    1. Applied rewrites32.5%

                                      \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites32.5%

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

                                      if 1.02e21 < y.re

                                      1. Initial program 28.8%

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

                                          \[\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}} \]
                                        2. lower-cos.f64N/A

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

                                          \[\leadsto \cos \color{blue}{\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. lower-atan2.f64N/A

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(y.re, \color{blue}{\log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}, 1\right) \]
                                      8. Recombined 2 regimes into one program.
                                      9. Add Preprocessing

                                      Alternative 8: 26.6% accurate, 5.7× speedup?

                                      \[\begin{array}{l} \\ \frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)} \end{array} \]
                                      (FPCore (x.re x.im y.re y.im)
                                       :precision binary64
                                       (/ 1.0 (fma (atan2 x.im x.re) y.im 1.0)))
                                      double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                                      	return 1.0 / fma(atan2(x_46_im, x_46_re), y_46_im, 1.0);
                                      }
                                      
                                      function code(x_46_re, x_46_im, y_46_re, y_46_im)
                                      	return Float64(1.0 / fma(atan(x_46_im, x_46_re), y_46_im, 1.0))
                                      end
                                      
                                      code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 / N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im + 1.0), $MachinePrecision]), $MachinePrecision]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)}
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 33.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. 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 rewrites30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                                      9. Step-by-step derivation
                                        1. Applied rewrites25.7%

                                          \[\leadsto \frac{1}{1 + \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites25.7%

                                            \[\leadsto \frac{1}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.im, 1\right)} \]
                                          2. Add Preprocessing

                                          Alternative 9: 26.1% 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 33.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 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. lower-*.f64N/A

                                              \[\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}} \]
                                            2. lower-cos.f64N/A

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

                                              \[\leadsto \cos \color{blue}{\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. lower-atan2.f64N/A

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

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

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

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

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

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

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

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

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

                                              \[\leadsto 1 \]
                                            2. Add Preprocessing

                                            Reproduce

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