powComplex, real part

Percentage Accurate: 41.1% → 82.0%
Time: 28.9s
Alternatives: 12
Speedup: 4.1×

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 12 alternatives:

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

Initial Program: 41.1% 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: 82.0% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{-64}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\

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


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

    1. Initial program 46.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. Step-by-step derivation
      1. cancel-sign-sub-inv46.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 72.7%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*72.7%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified88.7%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Step-by-step derivation
      1. add-cube-cbrt88.7%

        \[\leadsto e^{\color{blue}{\left(\sqrt[3]{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \sqrt[3]{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}\right) \cdot \sqrt[3]{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}}} \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. pow388.7%

        \[\leadsto e^{\color{blue}{{\left(\sqrt[3]{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}^{3}}} \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) \]
      3. *-commutative88.7%

        \[\leadsto e^{{\left(\sqrt[3]{y.im \cdot \left(\color{blue}{\frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} \cdot y.re} - \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}^{3}} \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) \]
      4. associate-*l/88.7%

        \[\leadsto e^{{\left(\sqrt[3]{y.im \cdot \left(\color{blue}{\frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.re}{y.im}} - \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}^{3}} \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) \]
      5. associate-/l*88.7%

        \[\leadsto e^{{\left(\sqrt[3]{y.im \cdot \left(\color{blue}{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot \frac{y.re}{y.im}} - \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}^{3}} \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) \]
      6. hypot-undefine68.5%

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

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

        \[\leadsto e^{{\left(\sqrt[3]{y.im \cdot \left(\log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)} \cdot \frac{y.re}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}^{3}} \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) \]
    9. Applied egg-rr88.7%

      \[\leadsto e^{\color{blue}{{\left(\sqrt[3]{y.im \cdot \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot \frac{y.re}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}^{3}}} \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) \]

    if 1.00000000000000003e-300 < y.re < 3.8999999999999997e-64

    1. Initial program 39.3%

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

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

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

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 81.8%

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

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

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

    if 3.8999999999999997e-64 < y.re

    1. Initial program 31.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 61.0%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*61.0%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified76.6%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 33.9%

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

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

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

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

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

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

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

Alternative 2: 81.9% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;y.re \leq 3.5 \cdot 10^{-68}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \cos \left(y.im \cdot t\_1\right)\\


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

    1. Initial program 46.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. Step-by-step derivation
      1. cancel-sign-sub-inv46.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 72.7%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*72.7%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified88.7%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]

    if 6.09999999999999974e-295 < y.re < 3.50000000000000013e-68

    1. Initial program 39.3%

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

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

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

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 81.8%

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

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

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

    if 3.50000000000000013e-68 < y.re

    1. Initial program 31.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 61.0%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*61.0%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified76.6%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 33.9%

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

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

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

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

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

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

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

Alternative 3: 81.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 1.5 \cdot 10^{-12}:\\
\;\;\;\;e^{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < 1.5000000000000001e-12

    1. Initial program 42.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 65.1%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*65.1%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified81.3%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 42.4%

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

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

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

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

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

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

    if 1.5000000000000001e-12 < x.im

    1. Initial program 33.3%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 53.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)} \]
    4. Taylor expanded in y.re around 0 61.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} \]
    5. Taylor expanded in x.re around 0 85.7%

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

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

Alternative 4: 74.2% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;y.im \leq 30000:\\
\;\;\;\;e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)} \cdot \left(1 + -0.5 \cdot {\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.4599999999999999e63

    1. Initial program 37.4%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 44.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)} \]
    4. Taylor expanded in y.re around 0 46.9%

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

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 65.5%

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

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

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

    if -1.4599999999999999e63 < y.im < 3e4

    1. Initial program 42.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 64.2%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*64.2%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified87.6%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 43.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto e^{\color{blue}{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}} \cdot \left(1 + -0.5 \cdot {\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}\right) \]
    15. Step-by-step derivation
      1. +-commutative65.4%

        \[\leadsto e^{y.re \cdot \log \left(\sqrt{\color{blue}{{x.re}^{2} + {x.im}^{2}}}\right)} \cdot \left(1 + -0.5 \cdot {\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}\right) \]
      2. unpow265.4%

        \[\leadsto e^{y.re \cdot \log \left(\sqrt{\color{blue}{x.re \cdot x.re} + {x.im}^{2}}\right)} \cdot \left(1 + -0.5 \cdot {\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}\right) \]
      3. unpow265.4%

        \[\leadsto e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)} \cdot \left(1 + -0.5 \cdot {\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}\right) \]
      4. hypot-undefine88.0%

        \[\leadsto e^{y.re \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}} \cdot \left(1 + -0.5 \cdot {\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}\right) \]
    16. Simplified88.0%

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

    if 3e4 < y.im

    1. Initial program 39.1%

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

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

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

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

Alternative 5: 81.9% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -4.9999999999999995e-309

    1. Initial program 46.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. cancel-sign-sub-inv46.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 66.3%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*66.3%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified83.3%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 46.8%

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e-309 < x.re

    1. Initial program 35.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. Step-by-step derivation
      1. cancel-sign-sub-inv35.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 58.9%

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

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

        \[\leadsto e^{y.im \cdot \left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} + \color{blue}{\left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\right)} \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) \]
      3. unsub-neg58.9%

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*58.9%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified78.3%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 34.3%

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

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

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

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

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

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

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

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

Alternative 6: 77.1% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -4.999999999999985e-310

    1. Initial program 46.0%

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

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

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

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

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

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

    if -4.999999999999985e-310 < x.re

    1. Initial program 35.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. Step-by-step derivation
      1. cancel-sign-sub-inv35.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 58.9%

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

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

        \[\leadsto e^{y.im \cdot \left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} + \color{blue}{\left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\right)} \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) \]
      3. unsub-neg58.9%

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*58.9%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified78.3%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 34.3%

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

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

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

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

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

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

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

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

Alternative 7: 74.7% accurate, 1.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.19999999999999999e27

    1. Initial program 32.5%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 48.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)} \]
    4. Taylor expanded in y.re around 0 48.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} \]
    5. Taylor expanded in x.re around 0 22.7%

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 63.6%

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

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

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

    if -1.19999999999999999e27 < y.im < 6.2e13

    1. Initial program 44.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. Step-by-step derivation
      1. exp-diff44.5%

        \[\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-pow44.5%

        \[\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-define44.5%

        \[\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. *-commutative44.5%

        \[\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-prod44.5%

        \[\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. fma-define44.5%

        \[\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(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)} \]
      7. hypot-define88.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(\log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \]
      8. *-commutative88.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(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \color{blue}{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \]
    3. Simplified88.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(\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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around 0 86.7%

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{1}} \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) \]
    6. Taylor expanded in y.re around 0 43.5%

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{1} \cdot \color{blue}{\cos \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutative46.1%

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

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

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

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

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

    if 6.2e13 < y.im

    1. Initial program 40.3%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 66.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)} \]
    4. Taylor expanded in y.re around 0 71.1%

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

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

Alternative 8: 74.4% accurate, 2.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -5.4e26

    1. Initial program 32.5%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 48.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)} \]
    4. Taylor expanded in y.re around 0 48.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} \]
    5. Taylor expanded in x.re around 0 22.7%

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 63.6%

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

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

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

    if -5.4e26 < y.im < 6.2e13

    1. Initial program 44.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. Step-by-step derivation
      1. cancel-sign-sub-inv44.5%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 64.1%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*64.1%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified89.2%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 46.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.re} \]
    16. Simplified89.1%

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

    if 6.2e13 < y.im

    1. Initial program 40.3%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 66.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)} \]
    4. Taylor expanded in y.re around 0 71.1%

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

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

Alternative 9: 73.1% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
t_0 := -\tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -5.4 \cdot 10^{+26}:\\
\;\;\;\;e^{y.im \cdot t\_0}\\

\mathbf{elif}\;y.im \leq 4.2 \cdot 10^{+57}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\

\mathbf{else}:\\
\;\;\;\;{\left(e^{y.im}\right)}^{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -5.4e26

    1. Initial program 32.5%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 48.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)} \]
    4. Taylor expanded in y.re around 0 48.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} \]
    5. Taylor expanded in x.re around 0 22.7%

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 63.6%

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

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

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

    if -5.4e26 < y.im < 4.19999999999999982e57

    1. Initial program 46.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. Step-by-step derivation
      1. cancel-sign-sub-inv46.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 65.2%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*65.2%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified89.0%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 48.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.re} \]
      3. hypot-undefine88.2%

        \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.re} \]
    16. Simplified88.2%

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

    if 4.19999999999999982e57 < y.im

    1. Initial program 34.8%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Add Preprocessing
    3. Taylor expanded in y.im around 0 64.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)} \]
    4. Taylor expanded in y.re around 0 69.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} \]
    5. Taylor expanded in x.re around 0 39.7%

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 66.1%

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

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

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

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

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

Alternative 10: 73.0% accurate, 3.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -9.6 \cdot 10^{+27} \lor \neg \left(y.im \leq 1.05 \cdot 10^{+58}\right):\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.im -9.6e+27) (not (<= y.im 1.05e+58)))
   (exp (* y.im (- (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_im <= -9.6e+27) || !(y_46_im <= 1.05e+58)) {
		tmp = exp((y_46_im * -atan2(x_46_im, x_46_re)));
	} else {
		tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -9.6e+27) || !(y_46_im <= 1.05e+58)) {
		tmp = Math.exp((y_46_im * -Math.atan2(x_46_im, x_46_re)));
	} else {
		tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (y_46_im <= -9.6e+27) or not (y_46_im <= 1.05e+58):
		tmp = math.exp((y_46_im * -math.atan2(x_46_im, x_46_re)))
	else:
		tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((y_46_im <= -9.6e+27) || !(y_46_im <= 1.05e+58))
		tmp = exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))));
	else
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_im <= -9.6e+27) || ~((y_46_im <= 1.05e+58)))
		tmp = exp((y_46_im * -atan2(x_46_im, x_46_re)));
	else
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -9.6e+27], N[Not[LessEqual[y$46$im, 1.05e+58]], $MachinePrecision]], N[Exp[N[(y$46$im * (-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]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -9.6 \cdot 10^{+27} \lor \neg \left(y.im \leq 1.05 \cdot 10^{+58}\right):\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -9.59999999999999991e27 or 1.05000000000000006e58 < y.im

    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. Add Preprocessing
    3. Taylor expanded in y.im around 0 55.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)} \]
    4. Taylor expanded in y.re around 0 58.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} \]
    5. Taylor expanded in x.re around 0 30.8%

      \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
    6. Taylor expanded in y.re around 0 64.8%

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

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

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

    if -9.59999999999999991e27 < y.im < 1.05000000000000006e58

    1. Initial program 46.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. Step-by-step derivation
      1. cancel-sign-sub-inv46.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
    4. Add Preprocessing
    5. Taylor expanded in y.im around inf 65.2%

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

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

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

        \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
      4. associate-/l*65.2%

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

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

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

        \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
    7. Simplified89.0%

      \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    8. Taylor expanded in y.re around 0 48.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.re} \]
      3. hypot-undefine88.2%

        \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.re} \]
    16. Simplified88.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -9.6 \cdot 10^{+27} \lor \neg \left(y.im \leq 1.05 \cdot 10^{+58}\right):\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 62.0% accurate, 4.1× speedup?

\[\begin{array}{l} \\ {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (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) {
	return pow(hypot(x_46_im, x_46_re), y_46_re);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return hypot(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)
	tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}

\\
{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Derivation
  1. Initial program 40.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \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)} \]
  4. Add Preprocessing
  5. Taylor expanded in y.im around inf 62.5%

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

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

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

      \[\leadsto e^{y.im \cdot \color{blue}{\left(\frac{y.re \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    4. associate-/l*62.5%

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

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

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

      \[\leadsto e^{y.im \cdot \left(y.re \cdot \frac{\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)} \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) \]
  7. Simplified80.8%

    \[\leadsto e^{\color{blue}{y.im \cdot \left(y.re \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.im} - \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
  8. Taylor expanded in y.re around 0 40.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}} \]
  15. Step-by-step derivation
    1. unpow251.0%

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

      \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.re} \]
    3. hypot-undefine58.2%

      \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.re} \]
  16. Simplified58.2%

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}} \]
  17. Final simplification58.2%

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

Alternative 12: 39.5% accurate, 8.1× speedup?

\[\begin{array}{l} \\ {x.im}^{y.re} \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return pow(x_46_im, 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
    code = x_46im ** y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return Math.pow(x_46_im, y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return math.pow(x_46_im, y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return x_46_im ^ y_46_re
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = x_46_im ^ y_46_re;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[x$46$im, y$46$re], $MachinePrecision]
\begin{array}{l}

\\
{x.im}^{y.re}
\end{array}
Derivation
  1. Initial program 40.5%

    \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
  2. Add Preprocessing
  3. Taylor expanded in y.im around 0 59.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)} \]
  4. Taylor expanded in y.re around 0 62.0%

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

    \[\leadsto e^{\log \color{blue}{x.im} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1 \]
  6. Taylor expanded in y.im around 0 36.5%

    \[\leadsto \color{blue}{{x.im}^{y.re}} \cdot 1 \]
  7. Final simplification36.5%

    \[\leadsto {x.im}^{y.re} \]
  8. Add Preprocessing

Reproduce

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