powComplex, real part

Percentage Accurate: 40.7% → 79.8%
Time: 13.5s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 40.7% accurate, 1.0× speedup?

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

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

Alternative 1: 79.8% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := 0.5 \cdot \log \left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_3 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_4 := e^{t\_3 \cdot y.re - t\_1}\\
t_5 := \cos \left(\mathsf{fma}\left(t\_0, y.im, -t\_2\right)\right)\\
\mathbf{if}\;t\_4 \cdot \cos \left(t\_3 \cdot y.im + t\_2\right) \leq 5 \cdot 10^{+31}:\\
\;\;\;\;t\_4 \cdot \frac{1}{\frac{t\_5}{t\_5 \cdot \cos \left(\mathsf{fma}\left(t\_0, y.im, t\_2\right)\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < 5.00000000000000027e31

    1. Initial program 87.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. Applied egg-rr87.9%

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

    if 5.00000000000000027e31 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re))))

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

Alternative 2: 79.7% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < 0.98307167085611935

    1. Initial program 82.6%

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

    if 0.98307167085611935 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re))))

    1. Initial program 28.2%

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

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

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

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

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

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

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

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

Alternative 3: 80.2% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -6.19999999999999973e118

    1. Initial program 17.3%

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

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

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

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

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    6. Taylor expanded in y.re 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 \color{blue}{1} \]
    7. Step-by-step derivation
      1. Simplified70.0%

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

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

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

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

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

      if -6.19999999999999973e118 < x.im

      1. Initial program 48.2%

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

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

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

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

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

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

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

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

    Alternative 4: 70.0% accurate, 1.3× speedup?

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

      1. Initial program 43.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 e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      4. Step-by-step derivation
        1. lower-cos.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
        2. lower-*.f64N/A

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

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      6. Taylor expanded in y.re 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 \color{blue}{1} \]
      7. Step-by-step derivation
        1. Simplified65.3%

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

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

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

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

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

        if -1.1000000000000001e-295 < x.im < 4.6e-257

        1. Initial program 44.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re \cdot x.re}\right)}\right)}^{y.re} \cdot \mathsf{fma}\left({\tan^{-1}_* \frac{x.im}{x.re}}^{2}, -0.5 \cdot \left(y.re \cdot y.re\right), 1\right) \]
        13. Simplified70.0%

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

        if 4.6e-257 < x.im

        1. Initial program 43.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.1 \cdot 10^{-295}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.im\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.im \leq 4.6 \cdot 10^{-257}:\\ \;\;\;\;{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot \mathsf{fma}\left({\tan^{-1}_* \frac{x.im}{x.re}}^{2}, -0.5 \cdot \left(y.re \cdot y.re\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array} \]
      10. Add Preprocessing

      Alternative 5: 72.9% accurate, 1.3× speedup?

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

        1. Initial program 42.9%

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

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

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

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
        6. Taylor expanded in y.re 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 \color{blue}{1} \]
        7. Step-by-step derivation
          1. Simplified60.7%

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

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

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

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

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

          if -4.999999999999985e-310 < x.re

          1. Initial program 44.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 6: 70.7% accurate, 1.5× speedup?

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

          1. Initial program 44.9%

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

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

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

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

            \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
          6. Taylor expanded in y.re 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 \color{blue}{1} \]
          7. Step-by-step derivation
            1. Simplified63.5%

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

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

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

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

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

            if -7.19999999999999997e-174 < x.re < 1.25e-155

            1. Initial program 33.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 1.25e-155 < x.re

            1. Initial program 48.5%

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

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

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

              \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
            6. Taylor expanded in y.re 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 \color{blue}{1} \]
            7. Step-by-step derivation
              1. Simplified64.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \leq -7.2 \cdot 10^{-174}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \leq 1.25 \cdot 10^{-155}:\\ \;\;\;\;\mathsf{fma}\left({\tan^{-1}_* \frac{x.im}{x.re}}^{2}, -0.5 \cdot \left(y.re \cdot y.re\right), 1\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{fma}\left(y.re, \log x.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)}\\ \end{array} \]
            10. Add Preprocessing

            Alternative 7: 73.3% accurate, 2.1× speedup?

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

              1. Initial program 42.9%

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

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

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

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

                \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
              6. Taylor expanded in y.re 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 \color{blue}{1} \]
              7. Step-by-step derivation
                1. Simplified60.7%

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

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

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

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

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

                if -4.999999999999985e-310 < x.re

                1. Initial program 44.2%

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

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

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

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

                  \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                6. Taylor expanded in y.re 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 \color{blue}{1} \]
                7. Step-by-step derivation
                  1. Simplified56.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 8: 71.9% accurate, 2.1× speedup?

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

                  1. Initial program 41.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{{x.re}^{y.re}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
                  12. Step-by-step derivation
                    1. lower-pow.f6468.9

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

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

                  if -5.60000000000000034e31 < y.re < 6.1999999999999999e-7

                  1. Initial program 40.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 e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                  4. Step-by-step derivation
                    1. lower-cos.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                    2. lower-*.f64N/A

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

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

                    \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                  6. Taylor expanded in y.re 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 \color{blue}{1} \]
                  7. Step-by-step derivation
                    1. Simplified50.2%

                      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{1} \]
                    2. 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 1 \]
                    3. Step-by-step derivation
                      1. mul-1-negN/A

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

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

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

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

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

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

                        \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)}} \cdot 1 \]
                      8. lower-neg.f6475.9

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\mathsf{neg}\left(y.im\right)\right)}} \cdot 1 \]
                      7. *-rgt-identity75.9

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

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

                    if 6.1999999999999999e-7 < y.re

                    1. Initial program 49.9%

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

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

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

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

                      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                    6. Taylor expanded in y.re 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 \color{blue}{1} \]
                    7. Step-by-step derivation
                      1. Simplified69.1%

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

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

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

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

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

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

                          \[\leadsto e^{y.re \cdot \log \left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}}\right)} \cdot 1 \]
                        6. unpow2N/A

                          \[\leadsto e^{y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re \cdot x.re}\right)}\right)} \cdot 1 \]
                        7. lower-*.f6465.1

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

                        \[\leadsto e^{\color{blue}{y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}} \cdot 1 \]
                    8. Recombined 3 regimes into one program.
                    9. Final simplification71.4%

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

                    Alternative 9: 77.4% accurate, 2.8× speedup?

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

                      1. Initial program 47.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                      4. Step-by-step derivation
                        1. lower-cos.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                        2. lower-*.f64N/A

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

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

                        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                      6. Taylor expanded in y.re 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 \color{blue}{1} \]
                      7. Step-by-step derivation
                        1. Simplified68.0%

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

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

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

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

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

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

                            \[\leadsto e^{y.re \cdot \log \left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}}\right)} \cdot 1 \]
                          6. unpow2N/A

                            \[\leadsto e^{y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re \cdot x.re}\right)}\right)} \cdot 1 \]
                          7. lower-*.f6464.3

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

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

                        if -1.9000000000000001e-4 < y.re < 6.1999999999999999e-7

                        1. Initial program 39.1%

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

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

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

                          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                        6. Taylor expanded in y.re 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 \color{blue}{1} \]
                        7. Step-by-step derivation
                          1. Simplified49.4%

                            \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{1} \]
                          2. 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 1 \]
                          3. Step-by-step derivation
                            1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\mathsf{neg}\left(y.im\right)\right)}} \cdot 1 \]
                            7. *-rgt-identity76.8

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

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

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

                        Alternative 10: 74.0% accurate, 3.1× speedup?

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

                          1. Initial program 46.3%

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

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

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

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

                            \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                          6. Taylor expanded in y.re 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 \color{blue}{1} \]
                          7. Step-by-step derivation
                            1. Simplified68.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{{\left(\mathsf{neg}\left(\left(x.im + \frac{1}{2} \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)}^{y.re}} \cdot 1 \]
                            6. Step-by-step derivation
                              1. lower-pow.f64N/A

                                \[\leadsto \color{blue}{{\left(\mathsf{neg}\left(\left(x.im + \frac{1}{2} \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)}^{y.re}} \cdot 1 \]
                              2. +-commutativeN/A

                                \[\leadsto {\left(\mathsf{neg}\left(\color{blue}{\left(\frac{1}{2} \cdot \frac{{x.re}^{2}}{x.im} + x.im\right)}\right)\right)}^{y.re} \cdot 1 \]
                              3. distribute-neg-inN/A

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

                                \[\leadsto {\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{{x.re}^{2}}{x.im}} + \left(\mathsf{neg}\left(x.im\right)\right)\right)}^{y.re} \cdot 1 \]
                              5. metadata-evalN/A

                                \[\leadsto {\left(\color{blue}{\frac{-1}{2}} \cdot \frac{{x.re}^{2}}{x.im} + \left(\mathsf{neg}\left(x.im\right)\right)\right)}^{y.re} \cdot 1 \]
                              6. sub-negN/A

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

                                \[\leadsto {\color{blue}{\left(\frac{-1}{2} \cdot \frac{{x.re}^{2}}{x.im} - x.im\right)}}^{y.re} \cdot 1 \]
                              8. associate-*r/N/A

                                \[\leadsto {\left(\color{blue}{\frac{\frac{-1}{2} \cdot {x.re}^{2}}{x.im}} - x.im\right)}^{y.re} \cdot 1 \]
                              9. metadata-evalN/A

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

                                \[\leadsto {\left(\frac{\color{blue}{\mathsf{neg}\left(\frac{1}{2} \cdot {x.re}^{2}\right)}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                              11. lower-/.f64N/A

                                \[\leadsto {\left(\color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2} \cdot {x.re}^{2}\right)}{x.im}} - x.im\right)}^{y.re} \cdot 1 \]
                              12. *-commutativeN/A

                                \[\leadsto {\left(\frac{\mathsf{neg}\left(\color{blue}{{x.re}^{2} \cdot \frac{1}{2}}\right)}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                              13. distribute-rgt-neg-inN/A

                                \[\leadsto {\left(\frac{\color{blue}{{x.re}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                              14. metadata-evalN/A

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

                                \[\leadsto {\left(\frac{\color{blue}{{x.re}^{2} \cdot \frac{-1}{2}}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                              16. unpow2N/A

                                \[\leadsto {\left(\frac{\color{blue}{\left(x.re \cdot x.re\right)} \cdot \frac{-1}{2}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                              17. lower-*.f6454.8

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

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

                            if -5.39999999999999971e31 < y.re < 6.1999999999999999e-7

                            1. Initial program 40.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 e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                            4. Step-by-step derivation
                              1. lower-cos.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                              2. lower-*.f64N/A

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

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

                              \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                            6. Taylor expanded in y.re 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 \color{blue}{1} \]
                            7. Step-by-step derivation
                              1. Simplified50.2%

                                \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{1} \]
                              2. 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 1 \]
                              3. Step-by-step derivation
                                1. mul-1-negN/A

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

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

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

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

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

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

                                  \[\leadsto e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)}} \cdot 1 \]
                                8. lower-neg.f6475.9

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

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\mathsf{neg}\left(y.im\right)\right)}} \cdot 1 \]
                                7. *-rgt-identity75.9

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

                                \[\leadsto \color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}} \]
                            8. Recombined 2 regimes into one program.
                            9. Final simplification65.6%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -5.4 \cdot 10^{+31}:\\ \;\;\;\;{\left(\frac{\left(x.re \cdot x.re\right) \cdot -0.5}{x.im} - x.im\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 6.2 \cdot 10^{-7}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\left(x.re \cdot x.re\right) \cdot -0.5}{x.im} - x.im\right)}^{y.re}\\ \end{array} \]
                            10. Add Preprocessing

                            Alternative 11: 58.9% accurate, 4.9× speedup?

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

                              1. Initial program 45.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 e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                              4. Step-by-step derivation
                                1. lower-cos.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                2. lower-*.f64N/A

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

                                \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                              6. Taylor expanded in y.re 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 \color{blue}{1} \]
                              7. Step-by-step derivation
                                1. Simplified66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{{\left(\mathsf{neg}\left(\left(x.im + \frac{1}{2} \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)}^{y.re}} \cdot 1 \]
                                6. Step-by-step derivation
                                  1. lower-pow.f64N/A

                                    \[\leadsto \color{blue}{{\left(\mathsf{neg}\left(\left(x.im + \frac{1}{2} \cdot \frac{{x.re}^{2}}{x.im}\right)\right)\right)}^{y.re}} \cdot 1 \]
                                  2. +-commutativeN/A

                                    \[\leadsto {\left(\mathsf{neg}\left(\color{blue}{\left(\frac{1}{2} \cdot \frac{{x.re}^{2}}{x.im} + x.im\right)}\right)\right)}^{y.re} \cdot 1 \]
                                  3. distribute-neg-inN/A

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

                                    \[\leadsto {\left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \frac{{x.re}^{2}}{x.im}} + \left(\mathsf{neg}\left(x.im\right)\right)\right)}^{y.re} \cdot 1 \]
                                  5. metadata-evalN/A

                                    \[\leadsto {\left(\color{blue}{\frac{-1}{2}} \cdot \frac{{x.re}^{2}}{x.im} + \left(\mathsf{neg}\left(x.im\right)\right)\right)}^{y.re} \cdot 1 \]
                                  6. sub-negN/A

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

                                    \[\leadsto {\color{blue}{\left(\frac{-1}{2} \cdot \frac{{x.re}^{2}}{x.im} - x.im\right)}}^{y.re} \cdot 1 \]
                                  8. associate-*r/N/A

                                    \[\leadsto {\left(\color{blue}{\frac{\frac{-1}{2} \cdot {x.re}^{2}}{x.im}} - x.im\right)}^{y.re} \cdot 1 \]
                                  9. metadata-evalN/A

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

                                    \[\leadsto {\left(\frac{\color{blue}{\mathsf{neg}\left(\frac{1}{2} \cdot {x.re}^{2}\right)}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                                  11. lower-/.f64N/A

                                    \[\leadsto {\left(\color{blue}{\frac{\mathsf{neg}\left(\frac{1}{2} \cdot {x.re}^{2}\right)}{x.im}} - x.im\right)}^{y.re} \cdot 1 \]
                                  12. *-commutativeN/A

                                    \[\leadsto {\left(\frac{\mathsf{neg}\left(\color{blue}{{x.re}^{2} \cdot \frac{1}{2}}\right)}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                                  13. distribute-rgt-neg-inN/A

                                    \[\leadsto {\left(\frac{\color{blue}{{x.re}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                                  14. metadata-evalN/A

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

                                    \[\leadsto {\left(\frac{\color{blue}{{x.re}^{2} \cdot \frac{-1}{2}}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                                  16. unpow2N/A

                                    \[\leadsto {\left(\frac{\color{blue}{\left(x.re \cdot x.re\right)} \cdot \frac{-1}{2}}{x.im} - x.im\right)}^{y.re} \cdot 1 \]
                                  17. lower-*.f6452.7

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

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

                                if -3.89999999999999978e-47 < y.re < 2.4500000000000001e-8

                                1. Initial program 41.6%

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

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

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

                                  \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                6. Taylor expanded in y.re 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 \color{blue}{1} \]
                                7. Step-by-step derivation
                                  1. Simplified50.0%

                                    \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{1} \]
                                  2. 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 1 \]
                                  3. Step-by-step derivation
                                    1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto 1 + \color{blue}{\left(\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
                                    2. unsub-negN/A

                                      \[\leadsto \color{blue}{1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
                                    3. lower--.f64N/A

                                      \[\leadsto \color{blue}{1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
                                    4. lower-*.f64N/A

                                      \[\leadsto 1 - \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
                                    5. lower-atan2.f6447.4

                                      \[\leadsto 1 - y.im \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \]
                                  7. Simplified47.4%

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

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -3.9 \cdot 10^{-47}:\\ \;\;\;\;{\left(\frac{\left(x.re \cdot x.re\right) \cdot -0.5}{x.im} - x.im\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 2.45 \cdot 10^{-8}:\\ \;\;\;\;1 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\left(x.re \cdot x.re\right) \cdot -0.5}{x.im} - x.im\right)}^{y.re}\\ \end{array} \]
                                10. Add Preprocessing

                                Alternative 12: 25.9% accurate, 6.2× speedup?

                                \[\begin{array}{l} \\ 1 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im \end{array} \]
                                (FPCore (x.re x.im y.re y.im)
                                 :precision binary64
                                 (- 1.0 (* (atan2 x.im x.re) y.im)))
                                double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                                	return 1.0 - (atan2(x_46_im, x_46_re) * y_46_im);
                                }
                                
                                real(8) function code(x_46re, x_46im, y_46re, y_46im)
                                    real(8), intent (in) :: x_46re
                                    real(8), intent (in) :: x_46im
                                    real(8), intent (in) :: y_46re
                                    real(8), intent (in) :: y_46im
                                    code = 1.0d0 - (atan2(x_46im, x_46re) * y_46im)
                                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 - (Math.atan2(x_46_im, x_46_re) * y_46_im);
                                }
                                
                                def code(x_46_re, x_46_im, y_46_re, y_46_im):
                                	return 1.0 - (math.atan2(x_46_im, x_46_re) * y_46_im)
                                
                                function code(x_46_re, x_46_im, y_46_re, y_46_im)
                                	return Float64(1.0 - Float64(atan(x_46_im, x_46_re) * y_46_im))
                                end
                                
                                function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
                                	tmp = 1.0 - (atan2(x_46_im, x_46_re) * y_46_im);
                                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), $MachinePrecision]), $MachinePrecision]
                                
                                \begin{array}{l}
                                
                                \\
                                1 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im
                                \end{array}
                                
                                Derivation
                                1. Initial program 43.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 e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                4. Step-by-step derivation
                                  1. lower-cos.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                  2. lower-*.f64N/A

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

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

                                  \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                6. Taylor expanded in y.re 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 \color{blue}{1} \]
                                7. Step-by-step derivation
                                  1. Simplified59.0%

                                    \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{1} \]
                                  2. 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 1 \]
                                  3. Step-by-step derivation
                                    1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto 1 + \color{blue}{\left(\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
                                    2. unsub-negN/A

                                      \[\leadsto \color{blue}{1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
                                    3. lower--.f64N/A

                                      \[\leadsto \color{blue}{1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
                                    4. lower-*.f64N/A

                                      \[\leadsto 1 - \color{blue}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
                                    5. lower-atan2.f6423.2

                                      \[\leadsto 1 - y.im \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \]
                                  7. Simplified23.2%

                                    \[\leadsto \color{blue}{1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
                                  8. Final simplification23.2%

                                    \[\leadsto 1 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im \]
                                  9. Add Preprocessing

                                  Alternative 13: 25.8% 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 43.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 e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                  4. Step-by-step derivation
                                    1. lower-cos.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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                    2. lower-*.f64N/A

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

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

                                    \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
                                  6. Taylor expanded in y.re 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 \color{blue}{1} \]
                                  7. Step-by-step derivation
                                    1. Simplified59.0%

                                      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{1} \]
                                    2. 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 1 \]
                                    3. Step-by-step derivation
                                      1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \color{blue}{1} \]
                                    6. Step-by-step derivation
                                      1. Simplified23.0%

                                        \[\leadsto \color{blue}{1} \]
                                      2. Add Preprocessing

                                      Reproduce

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