powComplex, real part

Percentage Accurate: 40.3% → 78.9%
Time: 24.1s
Alternatives: 16
Speedup: 6.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 40.3% 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: 78.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_3 := y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_4 := \cos t\_3\\
\mathbf{if}\;y.re \leq -8.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{t\_4}{\frac{1 + t\_0}{t\_1}}\\

\mathbf{elif}\;y.re \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\frac{t\_4 + y.re \cdot \left(\left(-0.5 \cdot y.re\right) \cdot \left(t\_4 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot \sin t\_3\right)}{\frac{e^{t\_2}}{t\_1}}\\

\mathbf{elif}\;y.re \leq 1.8 \cdot 10^{+14}:\\
\;\;\;\;\frac{t\_4}{-\left(0 - e^{t\_0}\right)}\\

\mathbf{else}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_2} \cdot t\_4\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -8.2000000000000006e-9

    1. Initial program 38.6%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -8.2000000000000006e-9 < y.re < 4.9999999999999999e-141

    1. Initial program 42.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 4.9999999999999999e-141 < y.re < 1.8e14

    1. Initial program 40.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 1.8e14 < y.re

    1. Initial program 45.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 2: 78.7% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;y.re \leq 1.1 \cdot 10^{-139}:\\
\;\;\;\;\frac{t\_1}{t\_2}\\

\mathbf{elif}\;y.re \leq 10^{+18}:\\
\;\;\;\;\frac{t\_1}{-\left(0 - t\_2\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -5.0000000000000002e-14

    1. Initial program 39.4%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -5.0000000000000002e-14 < y.re < 1.10000000000000005e-139

    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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 1.10000000000000005e-139 < y.re < 1e18

    1. Initial program 40.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 1e18 < y.re

    1. Initial program 45.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 77.5% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;y.re \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\frac{t\_1}{t\_3}\\

\mathbf{elif}\;y.re \leq 76000000000000:\\
\;\;\;\;\frac{t\_1}{-\left(0 - t\_3\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -5.0000000000000002e-14 or 7.6e13 < y.re

    1. Initial program 41.7%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -5.0000000000000002e-14 < y.re < 4.9999999999999999e-141

    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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 4.9999999999999999e-141 < y.re < 7.6e13

    1. Initial program 41.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 76.9% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)}\\
t_1 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
t_2 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
t_3 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -4.8 \cdot 10^{-14}:\\
\;\;\;\;\frac{1}{\frac{1 + t\_3}{t\_1}}\\

\mathbf{elif}\;y.re \leq 7000000:\\
\;\;\;\;\frac{t\_2}{e^{t\_3}}\\

\mathbf{elif}\;y.re \leq 9.5 \cdot 10^{+45}:\\
\;\;\;\;t\_0 \cdot \left(1 + -0.5 \cdot \left({\tan^{-1}_* \frac{x.im}{x.re}}^{2} \cdot \left(y.re \cdot y.re\right)\right)\right)\\

\mathbf{elif}\;y.re \leq 2.75 \cdot 10^{+156}:\\
\;\;\;\;t\_0 \cdot 1\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{\frac{1}{t\_1}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -4.8e-14

    1. Initial program 39.4%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if -4.8e-14 < y.re < 7e6

    1. Initial program 40.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 7e6 < y.re < 9.4999999999999998e45

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 9.4999999999999998e45 < y.re < 2.7500000000000001e156

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 2.7500000000000001e156 < y.re

    1. Initial program 52.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 5: 77.9% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;y.re \leq 4.5 \cdot 10^{-140}:\\
\;\;\;\;\frac{t\_1}{t\_3}\\

\mathbf{elif}\;y.re \leq 1.65 \cdot 10^{+15}:\\
\;\;\;\;\frac{t\_1}{-\left(0 - t\_3\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\frac{1}{t\_0}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -1.75e-15

    1. Initial program 39.4%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if -1.75e-15 < y.re < 4.50000000000000004e-140

    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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 4.50000000000000004e-140 < y.re < 1.65e15

    1. Initial program 40.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 1.65e15 < y.re

    1. Initial program 45.0%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 6: 76.7% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;y.re \leq 13500000:\\
\;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{e^{t\_1}}\\

\mathbf{elif}\;y.re \leq 10^{+46}:\\
\;\;\;\;t\_0 \cdot \left(1 + -0.5 \cdot \left({\tan^{-1}_* \frac{x.im}{x.re}}^{2} \cdot \left(y.re \cdot y.re\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -5.0000000000000002e-14

    1. Initial program 39.4%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if -5.0000000000000002e-14 < y.re < 1.35e7

    1. Initial program 40.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]

    if 1.35e7 < y.re < 9.9999999999999999e45

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 9.9999999999999999e45 < y.re

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 7: 76.2% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := {\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)}\\
\mathbf{if}\;y.re \leq -5 \cdot 10^{-14}:\\
\;\;\;\;\frac{1}{\frac{1 + t\_0}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\

\mathbf{elif}\;y.re \leq 6800000:\\
\;\;\;\;e^{0 - t\_0}\\

\mathbf{elif}\;y.re \leq 10^{+46}:\\
\;\;\;\;t\_1 \cdot \left(1 + -0.5 \cdot \left({\tan^{-1}_* \frac{x.im}{x.re}}^{2} \cdot \left(y.re \cdot y.re\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -5.0000000000000002e-14

    1. Initial program 39.4%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if -5.0000000000000002e-14 < y.re < 6.8e6

    1. Initial program 40.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 6.8e6 < y.re < 9.9999999999999999e45

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 9.9999999999999999e45 < y.re

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 8: 76.3% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := t\_0 + 1\\ t_2 := x.re \cdot x.re + x.im \cdot x.im\\ \mathbf{if}\;y.re \leq -4.9 \cdot 10^{-14}:\\ \;\;\;\;\frac{1}{\frac{1 + t\_0}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\ \mathbf{elif}\;y.re \leq 1.05 \cdot 10^{+14}:\\ \;\;\;\;e^{0 - t\_0}\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{+248}:\\ \;\;\;\;\frac{{t\_2}^{\left(\frac{y.re}{2}\right)}}{t\_1}\\ \mathbf{elif}\;y.re \leq 3.6 \cdot 10^{+306}:\\ \;\;\;\;\frac{\frac{-1}{t\_1}}{0 - {t\_2}^{\left(\frac{y.re}{-2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* y.im (atan2 x.im x.re)))
        (t_1 (+ t_0 1.0))
        (t_2 (+ (* x.re x.re) (* x.im x.im))))
   (if (<= y.re -4.9e-14)
     (/ 1.0 (/ (+ 1.0 t_0) (pow (hypot x.re x.im) y.re)))
     (if (<= y.re 1.05e+14)
       (exp (- 0.0 t_0))
       (if (<= y.re 2e+248)
         (/ (pow t_2 (/ y.re 2.0)) t_1)
         (if (<= y.re 3.6e+306)
           (/ (/ -1.0 t_1) (- 0.0 (pow t_2 (/ y.re -2.0))))
           (* (pow (+ (* x.im x.im) (* x.re x.re)) (/ y.re 2.0)) 1.0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
	double t_1 = t_0 + 1.0;
	double t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
	double tmp;
	if (y_46_re <= -4.9e-14) {
		tmp = 1.0 / ((1.0 + t_0) / pow(hypot(x_46_re, x_46_im), y_46_re));
	} else if (y_46_re <= 1.05e+14) {
		tmp = exp((0.0 - t_0));
	} else if (y_46_re <= 2e+248) {
		tmp = pow(t_2, (y_46_re / 2.0)) / t_1;
	} else if (y_46_re <= 3.6e+306) {
		tmp = (-1.0 / t_1) / (0.0 - pow(t_2, (y_46_re / -2.0)));
	} else {
		tmp = pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
	double t_1 = t_0 + 1.0;
	double t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
	double tmp;
	if (y_46_re <= -4.9e-14) {
		tmp = 1.0 / ((1.0 + t_0) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
	} else if (y_46_re <= 1.05e+14) {
		tmp = Math.exp((0.0 - t_0));
	} else if (y_46_re <= 2e+248) {
		tmp = Math.pow(t_2, (y_46_re / 2.0)) / t_1;
	} else if (y_46_re <= 3.6e+306) {
		tmp = (-1.0 / t_1) / (0.0 - Math.pow(t_2, (y_46_re / -2.0)));
	} else {
		tmp = Math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
	t_1 = t_0 + 1.0
	t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im)
	tmp = 0
	if y_46_re <= -4.9e-14:
		tmp = 1.0 / ((1.0 + t_0) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re))
	elif y_46_re <= 1.05e+14:
		tmp = math.exp((0.0 - t_0))
	elif y_46_re <= 2e+248:
		tmp = math.pow(t_2, (y_46_re / 2.0)) / t_1
	elif y_46_re <= 3.6e+306:
		tmp = (-1.0 / t_1) / (0.0 - math.pow(t_2, (y_46_re / -2.0)))
	else:
		tmp = math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
	t_1 = Float64(t_0 + 1.0)
	t_2 = Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))
	tmp = 0.0
	if (y_46_re <= -4.9e-14)
		tmp = Float64(1.0 / Float64(Float64(1.0 + t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re)));
	elseif (y_46_re <= 1.05e+14)
		tmp = exp(Float64(0.0 - t_0));
	elseif (y_46_re <= 2e+248)
		tmp = Float64((t_2 ^ Float64(y_46_re / 2.0)) / t_1);
	elseif (y_46_re <= 3.6e+306)
		tmp = Float64(Float64(-1.0 / t_1) / Float64(0.0 - (t_2 ^ Float64(y_46_re / -2.0))));
	else
		tmp = Float64((Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)) ^ Float64(y_46_re / 2.0)) * 1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = y_46_im * atan2(x_46_im, x_46_re);
	t_1 = t_0 + 1.0;
	t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
	tmp = 0.0;
	if (y_46_re <= -4.9e-14)
		tmp = 1.0 / ((1.0 + t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re));
	elseif (y_46_re <= 1.05e+14)
		tmp = exp((0.0 - t_0));
	elseif (y_46_re <= 2e+248)
		tmp = (t_2 ^ (y_46_re / 2.0)) / t_1;
	elseif (y_46_re <= 3.6e+306)
		tmp = (-1.0 / t_1) / (0.0 - (t_2 ^ (y_46_re / -2.0)));
	else
		tmp = (((x_46_im * x_46_im) + (x_46_re * x_46_re)) ^ (y_46_re / 2.0)) * 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -4.9e-14], N[(1.0 / N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.05e+14], N[Exp[N[(0.0 - t$95$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$re, 2e+248], N[(N[Power[t$95$2, N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 3.6e+306], N[(N[(-1.0 / t$95$1), $MachinePrecision] / N[(0.0 - N[Power[t$95$2, N[(y$46$re / -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := t\_0 + 1\\
t_2 := x.re \cdot x.re + x.im \cdot x.im\\
\mathbf{if}\;y.re \leq -4.9 \cdot 10^{-14}:\\
\;\;\;\;\frac{1}{\frac{1 + t\_0}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\

\mathbf{elif}\;y.re \leq 1.05 \cdot 10^{+14}:\\
\;\;\;\;e^{0 - t\_0}\\

\mathbf{elif}\;y.re \leq 2 \cdot 10^{+248}:\\
\;\;\;\;\frac{{t\_2}^{\left(\frac{y.re}{2}\right)}}{t\_1}\\

\mathbf{elif}\;y.re \leq 3.6 \cdot 10^{+306}:\\
\;\;\;\;\frac{\frac{-1}{t\_1}}{0 - {t\_2}^{\left(\frac{y.re}{-2}\right)}}\\

\mathbf{else}:\\
\;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -4.89999999999999995e-14

    1. Initial program 39.4%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if -4.89999999999999995e-14 < y.re < 1.05e14

    1. Initial program 41.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 1.05e14 < y.re < 2.00000000000000009e248

    1. Initial program 42.2%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
    10. Applied egg-rr0

      \[\leadsto expr\]

    if 2.00000000000000009e248 < y.re < 3.6000000000000002e306

    1. Initial program 53.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
    10. Applied egg-rr0

      \[\leadsto expr\]

    if 3.6000000000000002e306 < y.re

    1. Initial program 0.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 9: 76.1% accurate, 3.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := t\_0 + 1\\ t_2 := x.re \cdot x.re + x.im \cdot x.im\\ t_3 := \frac{{t\_2}^{\left(\frac{y.re}{2}\right)}}{t\_1}\\ \mathbf{if}\;y.re \leq -1650000000:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y.re \leq 80000000000000:\\ \;\;\;\;e^{0 - t\_0}\\ \mathbf{elif}\;y.re \leq 6 \cdot 10^{+254}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y.re \leq 10^{+307}:\\ \;\;\;\;\frac{\frac{-1}{t\_1}}{0 - {t\_2}^{\left(\frac{y.re}{-2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* y.im (atan2 x.im x.re)))
        (t_1 (+ t_0 1.0))
        (t_2 (+ (* x.re x.re) (* x.im x.im)))
        (t_3 (/ (pow t_2 (/ y.re 2.0)) t_1)))
   (if (<= y.re -1650000000.0)
     t_3
     (if (<= y.re 80000000000000.0)
       (exp (- 0.0 t_0))
       (if (<= y.re 6e+254)
         t_3
         (if (<= y.re 1e+307)
           (/ (/ -1.0 t_1) (- 0.0 (pow t_2 (/ y.re -2.0))))
           (* (pow (+ (* x.im x.im) (* x.re x.re)) (/ y.re 2.0)) 1.0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
	double t_1 = t_0 + 1.0;
	double t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
	double t_3 = pow(t_2, (y_46_re / 2.0)) / t_1;
	double tmp;
	if (y_46_re <= -1650000000.0) {
		tmp = t_3;
	} else if (y_46_re <= 80000000000000.0) {
		tmp = exp((0.0 - t_0));
	} else if (y_46_re <= 6e+254) {
		tmp = t_3;
	} else if (y_46_re <= 1e+307) {
		tmp = (-1.0 / t_1) / (0.0 - pow(t_2, (y_46_re / -2.0)));
	} else {
		tmp = pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = y_46im * atan2(x_46im, x_46re)
    t_1 = t_0 + 1.0d0
    t_2 = (x_46re * x_46re) + (x_46im * x_46im)
    t_3 = (t_2 ** (y_46re / 2.0d0)) / t_1
    if (y_46re <= (-1650000000.0d0)) then
        tmp = t_3
    else if (y_46re <= 80000000000000.0d0) then
        tmp = exp((0.0d0 - t_0))
    else if (y_46re <= 6d+254) then
        tmp = t_3
    else if (y_46re <= 1d+307) then
        tmp = ((-1.0d0) / t_1) / (0.0d0 - (t_2 ** (y_46re / (-2.0d0))))
    else
        tmp = (((x_46im * x_46im) + (x_46re * x_46re)) ** (y_46re / 2.0d0)) * 1.0d0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
	double t_1 = t_0 + 1.0;
	double t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
	double t_3 = Math.pow(t_2, (y_46_re / 2.0)) / t_1;
	double tmp;
	if (y_46_re <= -1650000000.0) {
		tmp = t_3;
	} else if (y_46_re <= 80000000000000.0) {
		tmp = Math.exp((0.0 - t_0));
	} else if (y_46_re <= 6e+254) {
		tmp = t_3;
	} else if (y_46_re <= 1e+307) {
		tmp = (-1.0 / t_1) / (0.0 - Math.pow(t_2, (y_46_re / -2.0)));
	} else {
		tmp = Math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
	t_1 = t_0 + 1.0
	t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im)
	t_3 = math.pow(t_2, (y_46_re / 2.0)) / t_1
	tmp = 0
	if y_46_re <= -1650000000.0:
		tmp = t_3
	elif y_46_re <= 80000000000000.0:
		tmp = math.exp((0.0 - t_0))
	elif y_46_re <= 6e+254:
		tmp = t_3
	elif y_46_re <= 1e+307:
		tmp = (-1.0 / t_1) / (0.0 - math.pow(t_2, (y_46_re / -2.0)))
	else:
		tmp = math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
	t_1 = Float64(t_0 + 1.0)
	t_2 = Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))
	t_3 = Float64((t_2 ^ Float64(y_46_re / 2.0)) / t_1)
	tmp = 0.0
	if (y_46_re <= -1650000000.0)
		tmp = t_3;
	elseif (y_46_re <= 80000000000000.0)
		tmp = exp(Float64(0.0 - t_0));
	elseif (y_46_re <= 6e+254)
		tmp = t_3;
	elseif (y_46_re <= 1e+307)
		tmp = Float64(Float64(-1.0 / t_1) / Float64(0.0 - (t_2 ^ Float64(y_46_re / -2.0))));
	else
		tmp = Float64((Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)) ^ Float64(y_46_re / 2.0)) * 1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = y_46_im * atan2(x_46_im, x_46_re);
	t_1 = t_0 + 1.0;
	t_2 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
	t_3 = (t_2 ^ (y_46_re / 2.0)) / t_1;
	tmp = 0.0;
	if (y_46_re <= -1650000000.0)
		tmp = t_3;
	elseif (y_46_re <= 80000000000000.0)
		tmp = exp((0.0 - t_0));
	elseif (y_46_re <= 6e+254)
		tmp = t_3;
	elseif (y_46_re <= 1e+307)
		tmp = (-1.0 / t_1) / (0.0 - (t_2 ^ (y_46_re / -2.0)));
	else
		tmp = (((x_46_im * x_46_im) + (x_46_re * x_46_re)) ^ (y_46_re / 2.0)) * 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[t$95$2, N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[y$46$re, -1650000000.0], t$95$3, If[LessEqual[y$46$re, 80000000000000.0], N[Exp[N[(0.0 - t$95$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$re, 6e+254], t$95$3, If[LessEqual[y$46$re, 1e+307], N[(N[(-1.0 / t$95$1), $MachinePrecision] / N[(0.0 - N[Power[t$95$2, N[(y$46$re / -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq 80000000000000:\\
\;\;\;\;e^{0 - t\_0}\\

\mathbf{elif}\;y.re \leq 6 \cdot 10^{+254}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y.re \leq 10^{+307}:\\
\;\;\;\;\frac{\frac{-1}{t\_1}}{0 - {t\_2}^{\left(\frac{y.re}{-2}\right)}}\\

\mathbf{else}:\\
\;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -1.65e9 or 8e13 < y.re < 6.00000000000000014e254

    1. Initial program 39.6%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
    10. Applied egg-rr0

      \[\leadsto expr\]

    if -1.65e9 < y.re < 8e13

    1. Initial program 42.2%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 6.00000000000000014e254 < y.re < 9.99999999999999986e306

    1. Initial program 53.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
    10. Applied egg-rr0

      \[\leadsto expr\]

    if 9.99999999999999986e306 < y.re

    1. Initial program 0.0%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 10: 76.8% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.re \leq -1650000000:\\ \;\;\;\;\frac{{\left(x.re \cdot x.re + x.im \cdot x.im\right)}^{\left(\frac{y.re}{2}\right)}}{t\_0 + 1}\\ \mathbf{elif}\;y.re \leq 95000000000000:\\ \;\;\;\;e^{0 - t\_0}\\ \mathbf{else}:\\ \;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* y.im (atan2 x.im x.re))))
   (if (<= y.re -1650000000.0)
     (/ (pow (+ (* x.re x.re) (* x.im x.im)) (/ y.re 2.0)) (+ t_0 1.0))
     (if (<= y.re 95000000000000.0)
       (exp (- 0.0 t_0))
       (* (pow (+ (* x.im x.im) (* x.re x.re)) (/ y.re 2.0)) 1.0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_im * atan2(x_46_im, x_46_re);
	double tmp;
	if (y_46_re <= -1650000000.0) {
		tmp = pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (t_0 + 1.0);
	} else if (y_46_re <= 95000000000000.0) {
		tmp = exp((0.0 - t_0));
	} else {
		tmp = pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.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 = y_46im * atan2(x_46im, x_46re)
    if (y_46re <= (-1650000000.0d0)) then
        tmp = (((x_46re * x_46re) + (x_46im * x_46im)) ** (y_46re / 2.0d0)) / (t_0 + 1.0d0)
    else if (y_46re <= 95000000000000.0d0) then
        tmp = exp((0.0d0 - t_0))
    else
        tmp = (((x_46im * x_46im) + (x_46re * x_46re)) ** (y_46re / 2.0d0)) * 1.0d0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
	double tmp;
	if (y_46_re <= -1650000000.0) {
		tmp = Math.pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (t_0 + 1.0);
	} else if (y_46_re <= 95000000000000.0) {
		tmp = Math.exp((0.0 - t_0));
	} else {
		tmp = Math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = y_46_im * math.atan2(x_46_im, x_46_re)
	tmp = 0
	if y_46_re <= -1650000000.0:
		tmp = math.pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (t_0 + 1.0)
	elif y_46_re <= 95000000000000.0:
		tmp = math.exp((0.0 - t_0))
	else:
		tmp = math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(y_46_im * atan(x_46_im, x_46_re))
	tmp = 0.0
	if (y_46_re <= -1650000000.0)
		tmp = Float64((Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)) ^ Float64(y_46_re / 2.0)) / Float64(t_0 + 1.0));
	elseif (y_46_re <= 95000000000000.0)
		tmp = exp(Float64(0.0 - t_0));
	else
		tmp = Float64((Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)) ^ Float64(y_46_re / 2.0)) * 1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = y_46_im * atan2(x_46_im, x_46_re);
	tmp = 0.0;
	if (y_46_re <= -1650000000.0)
		tmp = (((x_46_re * x_46_re) + (x_46_im * x_46_im)) ^ (y_46_re / 2.0)) / (t_0 + 1.0);
	elseif (y_46_re <= 95000000000000.0)
		tmp = exp((0.0 - t_0));
	else
		tmp = (((x_46_im * x_46_im) + (x_46_re * x_46_re)) ^ (y_46_re / 2.0)) * 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1650000000.0], N[(N[Power[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 95000000000000.0], N[Exp[N[(0.0 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(N[Power[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq 95000000000000:\\
\;\;\;\;e^{0 - t\_0}\\

\mathbf{else}:\\
\;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\


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

    1. Initial program 37.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
    10. Applied egg-rr0

      \[\leadsto expr\]

    if -1.65e9 < y.re < 9.5e13

    1. Initial program 42.2%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 9.5e13 < y.re

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 77.2% accurate, 3.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -5 \cdot 10^{-14}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 76000000000000:\\ \;\;\;\;e^{0 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.re -5e-14)
   (pow (hypot x.im x.re) y.re)
   (if (<= y.re 76000000000000.0)
     (exp (- 0.0 (* y.im (atan2 x.im x.re))))
     (* (pow (+ (* x.im x.im) (* x.re x.re)) (/ y.re 2.0)) 1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= -5e-14) {
		tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
	} else if (y_46_re <= 76000000000000.0) {
		tmp = exp((0.0 - (y_46_im * atan2(x_46_im, x_46_re))));
	} else {
		tmp = pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= -5e-14) {
		tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
	} else if (y_46_re <= 76000000000000.0) {
		tmp = Math.exp((0.0 - (y_46_im * Math.atan2(x_46_im, x_46_re))));
	} else {
		tmp = Math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_re <= -5e-14:
		tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
	elif y_46_re <= 76000000000000.0:
		tmp = math.exp((0.0 - (y_46_im * math.atan2(x_46_im, x_46_re))))
	else:
		tmp = math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_re <= -5e-14)
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	elseif (y_46_re <= 76000000000000.0)
		tmp = exp(Float64(0.0 - Float64(y_46_im * atan(x_46_im, x_46_re))));
	else
		tmp = Float64((Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)) ^ Float64(y_46_re / 2.0)) * 1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_re <= -5e-14)
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	elseif (y_46_re <= 76000000000000.0)
		tmp = exp((0.0 - (y_46_im * atan2(x_46_im, x_46_re))));
	else
		tmp = (((x_46_im * x_46_im) + (x_46_re * x_46_re)) ^ (y_46_re / 2.0)) * 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -5e-14], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 76000000000000.0], N[Exp[N[(0.0 - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Power[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -5 \cdot 10^{-14}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\

\mathbf{elif}\;y.re \leq 76000000000000:\\
\;\;\;\;e^{0 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

\mathbf{else}:\\
\;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\


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

    1. Initial program 39.4%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -5.0000000000000002e-14 < y.re < 7.6e13

    1. Initial program 41.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 7.6e13 < y.re

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 12: 64.1% accurate, 4.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -4 \cdot 10^{+80}:\\ \;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -4e+80)
   (* (pow (+ (* x.im x.im) (* x.re x.re)) (/ y.re 2.0)) 1.0)
   (pow (hypot x.im x.re) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -4e+80) {
		tmp = pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	} else {
		tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -4e+80) {
		tmp = Math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	} else {
		tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_im <= -4e+80:
		tmp = math.pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0
	else:
		tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -4e+80)
		tmp = Float64((Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)) ^ Float64(y_46_re / 2.0)) * 1.0);
	else
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_im <= -4e+80)
		tmp = (((x_46_im * x_46_im) + (x_46_re * x_46_re)) ^ (y_46_re / 2.0)) * 1.0;
	else
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -4e+80], N[(N[Power[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -4 \cdot 10^{+80}:\\
\;\;\;\;{\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\

\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -4e80

    1. Initial program 20.4%

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -4e80 < y.im

    1. Initial program 48.1%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 61.6% accurate, 6.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\ \mathbf{if}\;y.re \leq -1.15 \cdot 10^{-94}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 1700000:\\ \;\;\;\;\frac{1}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re} + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (pow (+ (* x.im x.im) (* x.re x.re)) (/ y.re 2.0)) 1.0)))
   (if (<= y.re -1.15e-94)
     t_0
     (if (<= y.re 1700000.0) (/ 1.0 (+ (* y.im (atan2 x.im x.re)) 1.0)) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = pow(((x_46_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	double tmp;
	if (y_46_re <= -1.15e-94) {
		tmp = t_0;
	} else if (y_46_re <= 1700000.0) {
		tmp = 1.0 / ((y_46_im * atan2(x_46_im, x_46_re)) + 1.0);
	} 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_46im * x_46im) + (x_46re * x_46re)) ** (y_46re / 2.0d0)) * 1.0d0
    if (y_46re <= (-1.15d-94)) then
        tmp = t_0
    else if (y_46re <= 1700000.0d0) then
        tmp = 1.0d0 / ((y_46im * atan2(x_46im, x_46re)) + 1.0d0)
    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_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0;
	double tmp;
	if (y_46_re <= -1.15e-94) {
		tmp = t_0;
	} else if (y_46_re <= 1700000.0) {
		tmp = 1.0 / ((y_46_im * Math.atan2(x_46_im, x_46_re)) + 1.0);
	} 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_im * x_46_im) + (x_46_re * x_46_re)), (y_46_re / 2.0)) * 1.0
	tmp = 0
	if y_46_re <= -1.15e-94:
		tmp = t_0
	elif y_46_re <= 1700000.0:
		tmp = 1.0 / ((y_46_im * math.atan2(x_46_im, x_46_re)) + 1.0)
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64((Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)) ^ Float64(y_46_re / 2.0)) * 1.0)
	tmp = 0.0
	if (y_46_re <= -1.15e-94)
		tmp = t_0;
	elseif (y_46_re <= 1700000.0)
		tmp = Float64(1.0 / Float64(Float64(y_46_im * atan(x_46_im, x_46_re)) + 1.0));
	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_im * x_46_im) + (x_46_re * x_46_re)) ^ (y_46_re / 2.0)) * 1.0;
	tmp = 0.0;
	if (y_46_re <= -1.15e-94)
		tmp = t_0;
	elseif (y_46_re <= 1700000.0)
		tmp = 1.0 / ((y_46_im * atan2(x_46_im, x_46_re)) + 1.0);
	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[(N[Power[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[y$46$re, -1.15e-94], t$95$0, If[LessEqual[y$46$re, 1700000.0], N[(1.0 / N[(N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x.im \cdot x.im + x.re \cdot x.re\right)}^{\left(\frac{y.re}{2}\right)} \cdot 1\\
\mathbf{if}\;y.re \leq -1.15 \cdot 10^{-94}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 1700000:\\
\;\;\;\;\frac{1}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re} + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -1.15e-94 or 1.7e6 < y.re

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if -1.15e-94 < y.re < 1.7e6

    1. Initial program 41.7%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
    10. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    11. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 29.0% accurate, 7.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -4.2 \cdot 10^{+33}:\\ \;\;\;\;y.im \cdot \left(0 - \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re} + 1}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.re -4.2e+33)
   (* y.im (- 0.0 (atan2 x.im x.re)))
   (/ 1.0 (+ (* y.im (atan2 x.im x.re)) 1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= -4.2e+33) {
		tmp = y_46_im * (0.0 - atan2(x_46_im, x_46_re));
	} else {
		tmp = 1.0 / ((y_46_im * atan2(x_46_im, x_46_re)) + 1.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) :: tmp
    if (y_46re <= (-4.2d+33)) then
        tmp = y_46im * (0.0d0 - atan2(x_46im, x_46re))
    else
        tmp = 1.0d0 / ((y_46im * atan2(x_46im, x_46re)) + 1.0d0)
    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 tmp;
	if (y_46_re <= -4.2e+33) {
		tmp = y_46_im * (0.0 - Math.atan2(x_46_im, x_46_re));
	} else {
		tmp = 1.0 / ((y_46_im * Math.atan2(x_46_im, x_46_re)) + 1.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_re <= -4.2e+33:
		tmp = y_46_im * (0.0 - math.atan2(x_46_im, x_46_re))
	else:
		tmp = 1.0 / ((y_46_im * math.atan2(x_46_im, x_46_re)) + 1.0)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_re <= -4.2e+33)
		tmp = Float64(y_46_im * Float64(0.0 - atan(x_46_im, x_46_re)));
	else
		tmp = Float64(1.0 / Float64(Float64(y_46_im * atan(x_46_im, x_46_re)) + 1.0));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_re <= -4.2e+33)
		tmp = y_46_im * (0.0 - atan2(x_46_im, x_46_re));
	else
		tmp = 1.0 / ((y_46_im * atan2(x_46_im, x_46_re)) + 1.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -4.2e+33], N[(y$46$im * N[(0.0 - N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.2 \cdot 10^{+33}:\\
\;\;\;\;y.im \cdot \left(0 - \tan^{-1}_* \frac{x.im}{x.re}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re} + 1}\\


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

    1. Initial program 37.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if -4.2000000000000001e33 < y.re

    1. Initial program 42.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]
    10. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    11. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 28.7% accurate, 7.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -650:\\ \;\;\;\;y.im \cdot \left(0 - \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.re -650.0) (* y.im (- 0.0 (atan2 x.im x.re))) 1.0))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= -650.0) {
		tmp = y_46_im * (0.0 - atan2(x_46_im, x_46_re));
	} else {
		tmp = 1.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) :: tmp
    if (y_46re <= (-650.0d0)) then
        tmp = y_46im * (0.0d0 - atan2(x_46im, x_46re))
    else
        tmp = 1.0d0
    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 tmp;
	if (y_46_re <= -650.0) {
		tmp = y_46_im * (0.0 - Math.atan2(x_46_im, x_46_re));
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_re <= -650.0:
		tmp = y_46_im * (0.0 - math.atan2(x_46_im, x_46_re))
	else:
		tmp = 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_re <= -650.0)
		tmp = Float64(y_46_im * Float64(0.0 - atan(x_46_im, x_46_re)));
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_re <= -650.0)
		tmp = y_46_im * (0.0 - atan2(x_46_im, x_46_re));
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -650.0], N[(y$46$im * N[(0.0 - N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -650:\\
\;\;\;\;y.im \cdot \left(0 - \tan^{-1}_* \frac{x.im}{x.re}\right)\\

\mathbf{else}:\\
\;\;\;\;1\\


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

    1. Initial program 38.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. Simplified0

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in y.im around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
    8. Taylor expanded in y.im around inf 0

      \[\leadsto expr\]
    9. Simplified0

      \[\leadsto expr\]

    if -650 < y.re

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

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Taylor expanded in y.re around 0 0

      \[\leadsto expr\]
    6. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 16: 26.2% accurate, 829.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 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 0

    \[\leadsto expr\]
  4. Simplified0

    \[\leadsto expr\]
  5. Taylor expanded in y.re around 0 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Add Preprocessing

Reproduce

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