powComplex, real part

Percentage Accurate: 40.2% → 79.7%
Time: 16.6s
Alternatives: 11
Speedup: 4.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 40.2% accurate, 1.0× speedup?

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

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

Alternative 1: 79.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (hypot x.re x.im))))
   (*
    (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
    (cos (fma t_0 y.im (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = log(hypot(x_46_re, x_46_im));
	return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = log(hypot(x_46_re, 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(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))))
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, 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[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 34.9%

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

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

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

    Alternative 2: 76.4% accurate, 0.5× speedup?

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

      1. Initial program 79.1%

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

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

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

      1. Initial program 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. Step-by-step derivation
        1. exp-diff0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 74.8% accurate, 1.2× speedup?

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

      1. Initial program 38.0%

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

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

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

      if -3.60000000000000007e-68 < y.re < 5.8000000000000002e27

      1. Initial program 32.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 5.8000000000000002e27 < y.re

      1. Initial program 35.7%

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

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

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

    Alternative 4: 75.8% accurate, 1.3× speedup?

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

      1. Initial program 35.3%

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

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

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

      if -9.00000000000000057e-5 < y.re < 5.8000000000000002e27

      1. Initial program 34.5%

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

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

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

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

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

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

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

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

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

      if 5.8000000000000002e27 < y.re

      1. Initial program 35.7%

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

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

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

    Alternative 5: 75.0% accurate, 1.6× speedup?

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

      1. Initial program 35.3%

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

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

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

      if -0.048000000000000001 < y.re < 9.99999999999999958e27

      1. Initial program 34.5%

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

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

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

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

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

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

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

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

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

      if 9.99999999999999958e27 < y.re

      1. Initial program 35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 74.9% accurate, 2.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;y.re \leq 1.05 \cdot 10^{+29}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (<= y.re -2.5e-12)
       (exp
        (-
         (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
         (* (atan2 x.im x.re) y.im)))
       (if (<= y.re 1.05e+29)
         (exp (* (atan2 x.im x.re) (- y.im)))
         (* (cos (* y.re (atan2 x.im x.re))) (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_re <= -2.5e-12) {
    		tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
    	} else if (y_46_re <= 1.05e+29) {
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	} else {
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * 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_re <= -2.5e-12) {
    		tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
    	} else if (y_46_re <= 1.05e+29) {
    		tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
    	} else {
    		tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * 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_re <= -2.5e-12:
    		tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
    	elif y_46_re <= 1.05e+29:
    		tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
    	else:
    		tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * 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_re <= -2.5e-12)
    		tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im)));
    	elseif (y_46_re <= 1.05e+29)
    		tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)));
    	else
    		tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (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_re <= -2.5e-12)
    		tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
    	elseif (y_46_re <= 1.05e+29)
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	else
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (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$re, -2.5e-12], N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$re, 1.05e+29], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12}:\\
    \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
    
    \mathbf{elif}\;y.re \leq 1.05 \cdot 10^{+29}:\\
    \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.re < -2.49999999999999985e-12

      1. Initial program 36.6%

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

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

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

      if -2.49999999999999985e-12 < y.re < 1.0500000000000001e29

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

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

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

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

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

        \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
      7. Step-by-step derivation
        1. distribute-rgt-neg-in80.7%

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

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

      if 1.0500000000000001e29 < y.re

      1. Initial program 35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 73.8% accurate, 2.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -4 \cdot 10^{-16} \lor \neg \left(y.re \leq 1.45 \cdot 10^{+28}\right):\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (or (<= y.re -4e-16) (not (<= y.re 1.45e+28)))
       (* (cos (* y.re (atan2 x.im x.re))) (pow (hypot x.im x.re) y.re))
       (exp (* (atan2 x.im x.re) (- y.im)))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double tmp;
    	if ((y_46_re <= -4e-16) || !(y_46_re <= 1.45e+28)) {
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(hypot(x_46_im, x_46_re), y_46_re);
    	} else {
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	}
    	return tmp;
    }
    
    public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double tmp;
    	if ((y_46_re <= -4e-16) || !(y_46_re <= 1.45e+28)) {
    		tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
    	} else {
    		tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
    	}
    	return tmp;
    }
    
    def code(x_46_re, x_46_im, y_46_re, y_46_im):
    	tmp = 0
    	if (y_46_re <= -4e-16) or not (y_46_re <= 1.45e+28):
    		tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
    	else:
    		tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
    	return tmp
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	tmp = 0.0
    	if ((y_46_re <= -4e-16) || !(y_46_re <= 1.45e+28))
    		tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re));
    	else
    		tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)));
    	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 <= -4e-16) || ~((y_46_re <= 1.45e+28)))
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re);
    	else
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	end
    	tmp_2 = tmp;
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -4e-16], N[Not[LessEqual[y$46$re, 1.45e+28]], $MachinePrecision]], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.re \leq -4 \cdot 10^{-16} \lor \neg \left(y.re \leq 1.45 \cdot 10^{+28}\right):\\
    \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.re < -3.9999999999999999e-16 or 1.4500000000000001e28 < y.re

      1. Initial program 36.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.9999999999999999e-16 < y.re < 1.4500000000000001e28

      1. Initial program 33.6%

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

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

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

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

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

        \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
      7. Step-by-step derivation
        1. distribute-rgt-neg-in80.8%

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

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

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

    Alternative 8: 72.5% accurate, 2.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12}:\\ \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+29}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\frac{x.re \cdot x.re}{x.im} \cdot -0.5 - x.im\right)}^{y.re}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (<= y.re -2.5e-12)
       (pow (sqrt (+ (* x.re x.re) (* x.im x.im))) y.re)
       (if (<= y.re 3.8e+29)
         (exp (* (atan2 x.im x.re) (- y.im)))
         (*
          (cos (* y.re (atan2 x.im x.re)))
          (pow (- (* (/ (* x.re x.re) x.im) -0.5) x.im) 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_re <= -2.5e-12) {
    		tmp = pow(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
    	} else if (y_46_re <= 3.8e+29) {
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	} else {
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(((((x_46_re * x_46_re) / x_46_im) * -0.5) - x_46_im), y_46_re);
    	}
    	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 <= (-2.5d-12)) then
            tmp = sqrt(((x_46re * x_46re) + (x_46im * x_46im))) ** y_46re
        else if (y_46re <= 3.8d+29) then
            tmp = exp((atan2(x_46im, x_46re) * -y_46im))
        else
            tmp = cos((y_46re * atan2(x_46im, x_46re))) * (((((x_46re * x_46re) / x_46im) * (-0.5d0)) - x_46im) ** y_46re)
        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 <= -2.5e-12) {
    		tmp = Math.pow(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
    	} else if (y_46_re <= 3.8e+29) {
    		tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
    	} else {
    		tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(((((x_46_re * x_46_re) / x_46_im) * -0.5) - x_46_im), y_46_re);
    	}
    	return tmp;
    }
    
    def code(x_46_re, x_46_im, y_46_re, y_46_im):
    	tmp = 0
    	if y_46_re <= -2.5e-12:
    		tmp = math.pow(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re)
    	elif y_46_re <= 3.8e+29:
    		tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
    	else:
    		tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(((((x_46_re * x_46_re) / x_46_im) * -0.5) - x_46_im), 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_re <= -2.5e-12)
    		tmp = sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))) ^ y_46_re;
    	elseif (y_46_re <= 3.8e+29)
    		tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)));
    	else
    		tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (Float64(Float64(Float64(Float64(x_46_re * x_46_re) / x_46_im) * -0.5) - x_46_im) ^ y_46_re));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
    	tmp = 0.0;
    	if (y_46_re <= -2.5e-12)
    		tmp = sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))) ^ y_46_re;
    	elseif (y_46_re <= 3.8e+29)
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	else
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (((((x_46_re * x_46_re) / x_46_im) * -0.5) - x_46_im) ^ 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$re, -2.5e-12], N[Power[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 3.8e+29], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] / x$46$im), $MachinePrecision] * -0.5), $MachinePrecision] - x$46$im), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12}:\\
    \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
    
    \mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+29}:\\
    \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\frac{x.re \cdot x.re}{x.im} \cdot -0.5 - x.im\right)}^{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.re < -2.49999999999999985e-12

      1. Initial program 36.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.49999999999999985e-12 < y.re < 3.79999999999999971e29

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

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

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

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

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

        \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
      7. Step-by-step derivation
        1. distribute-rgt-neg-in80.7%

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

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

      if 3.79999999999999971e29 < y.re

      1. Initial program 35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\color{blue}{\left(-0.5 \cdot \frac{{x.re}^{2}}{x.im} + -1 \cdot x.im\right)}}^{y.re} \]
        2. mul-1-neg59.8%

          \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(-0.5 \cdot \frac{{x.re}^{2}}{x.im} + \color{blue}{\left(-x.im\right)}\right)}^{y.re} \]
        3. unsub-neg59.8%

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12}:\\ \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+29}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\frac{x.re \cdot x.re}{x.im} \cdot -0.5 - x.im\right)}^{y.re}\\ \end{array} \]

    Alternative 9: 71.0% accurate, 2.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12}:\\ \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+25}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.im}^{y.re}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (<= y.re -2.5e-12)
       (pow (sqrt (+ (* x.re x.re) (* x.im x.im))) y.re)
       (if (<= y.re 5.5e+25)
         (exp (* (atan2 x.im x.re) (- y.im)))
         (* (cos (* y.re (atan2 x.im x.re))) (pow x.im 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_re <= -2.5e-12) {
    		tmp = pow(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
    	} else if (y_46_re <= 5.5e+25) {
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	} else {
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(x_46_im, y_46_re);
    	}
    	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 <= (-2.5d-12)) then
            tmp = sqrt(((x_46re * x_46re) + (x_46im * x_46im))) ** y_46re
        else if (y_46re <= 5.5d+25) then
            tmp = exp((atan2(x_46im, x_46re) * -y_46im))
        else
            tmp = cos((y_46re * atan2(x_46im, x_46re))) * (x_46im ** y_46re)
        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 <= -2.5e-12) {
    		tmp = Math.pow(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
    	} else if (y_46_re <= 5.5e+25) {
    		tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
    	} else {
    		tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(x_46_im, y_46_re);
    	}
    	return tmp;
    }
    
    def code(x_46_re, x_46_im, y_46_re, y_46_im):
    	tmp = 0
    	if y_46_re <= -2.5e-12:
    		tmp = math.pow(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re)
    	elif y_46_re <= 5.5e+25:
    		tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
    	else:
    		tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(x_46_im, 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_re <= -2.5e-12)
    		tmp = sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))) ^ y_46_re;
    	elseif (y_46_re <= 5.5e+25)
    		tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)));
    	else
    		tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (x_46_im ^ y_46_re));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
    	tmp = 0.0;
    	if (y_46_re <= -2.5e-12)
    		tmp = sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))) ^ y_46_re;
    	elseif (y_46_re <= 5.5e+25)
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	else
    		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (x_46_im ^ y_46_re);
    	end
    	tmp_2 = tmp;
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -2.5e-12], N[Power[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 5.5e+25], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12}:\\
    \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
    
    \mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+25}:\\
    \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.im}^{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.re < -2.49999999999999985e-12

      1. Initial program 36.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.49999999999999985e-12 < y.re < 5.50000000000000018e25

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

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

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

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

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

        \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
      7. Step-by-step derivation
        1. distribute-rgt-neg-in81.0%

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

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

      if 5.50000000000000018e25 < y.re

      1. Initial program 35.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 75.8% accurate, 3.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12} \lor \neg \left(y.re \leq 5.8 \cdot 10^{+27}\right):\\ \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (or (<= y.re -2.5e-12) (not (<= y.re 5.8e+27)))
       (pow (sqrt (+ (* x.re x.re) (* x.im x.im))) y.re)
       (exp (* (atan2 x.im x.re) (- y.im)))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double tmp;
    	if ((y_46_re <= -2.5e-12) || !(y_46_re <= 5.8e+27)) {
    		tmp = pow(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
    	} else {
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	}
    	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 <= (-2.5d-12)) .or. (.not. (y_46re <= 5.8d+27))) then
            tmp = sqrt(((x_46re * x_46re) + (x_46im * x_46im))) ** y_46re
        else
            tmp = exp((atan2(x_46im, x_46re) * -y_46im))
        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 <= -2.5e-12) || !(y_46_re <= 5.8e+27)) {
    		tmp = Math.pow(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
    	} else {
    		tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
    	}
    	return tmp;
    }
    
    def code(x_46_re, x_46_im, y_46_re, y_46_im):
    	tmp = 0
    	if (y_46_re <= -2.5e-12) or not (y_46_re <= 5.8e+27):
    		tmp = math.pow(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re)
    	else:
    		tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
    	return tmp
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	tmp = 0.0
    	if ((y_46_re <= -2.5e-12) || !(y_46_re <= 5.8e+27))
    		tmp = sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))) ^ y_46_re;
    	else
    		tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)));
    	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 <= -2.5e-12) || ~((y_46_re <= 5.8e+27)))
    		tmp = sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))) ^ y_46_re;
    	else
    		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
    	end
    	tmp_2 = tmp;
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -2.5e-12], N[Not[LessEqual[y$46$re, 5.8e+27]], $MachinePrecision]], N[Power[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12} \lor \neg \left(y.re \leq 5.8 \cdot 10^{+27}\right):\\
    \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.re < -2.49999999999999985e-12 or 5.8000000000000002e27 < y.re

      1. Initial program 36.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.49999999999999985e-12 < y.re < 5.8000000000000002e27

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

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

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

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

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

        \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
      7. Step-by-step derivation
        1. distribute-rgt-neg-in80.7%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-12} \lor \neg \left(y.re \leq 5.8 \cdot 10^{+27}\right):\\ \;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \end{array} \]

    Alternative 11: 53.1% accurate, 4.0× speedup?

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

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

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

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

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

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \]
    7. Step-by-step derivation
      1. distribute-rgt-neg-in54.0%

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

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

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

    Reproduce

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