powComplex, real part

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

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

Initial Program: 40.7% accurate, 1.0× speedup?

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

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

Alternative 1: 79.8% accurate, 0.9× speedup?

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

\mathbf{elif}\;y.re \leq 10^{+106}:\\
\;\;\;\;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(y.im \cdot \left(t\_0 + y.re \cdot \frac{\tan^{-1}_* \frac{x.im}{x.re}}{y.im}\right)\right)\\

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


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

    1. Initial program 32.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.re around 0 41.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.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
    4. Step-by-step derivation
      1. unpow241.4%

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

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

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

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

    if -0.0359999999999999973 < y.re < 1.00000000000000009e106

    1. Initial program 42.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-inv42.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-define42.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-define42.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-in42.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-out42.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-define42.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-define85.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 \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. *-commutative85.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 \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. Simplified85.1%

      \[\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 41.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(y.im \cdot \left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) + \frac{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.im}\right)\right)} \]
    6. Step-by-step derivation
      1. unpow241.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(y.im \cdot \left(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) + \frac{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.im}\right)\right) \]
      2. unpow241.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(y.im \cdot \left(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) + \frac{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.im}\right)\right) \]
      3. hypot-undefine84.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 \left(y.im \cdot \left(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} + \frac{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.im}\right)\right) \]
      4. associate-/l*84.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 \left(y.im \cdot \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) + \color{blue}{y.re \cdot \frac{\tan^{-1}_* \frac{x.im}{x.re}}{y.im}}\right)\right) \]
    7. Simplified84.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(y.im \cdot \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) + y.re \cdot \frac{\tan^{-1}_* \frac{x.im}{x.re}}{y.im}\right)\right)} \]

    if 1.00000000000000009e106 < y.re

    1. Initial program 38.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. exp-diff29.8%

        \[\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-pow29.8%

        \[\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-define29.8%

        \[\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. *-commutative29.8%

        \[\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-prod29.8%

        \[\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-define29.8%

        \[\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-define48.9%

        \[\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. *-commutative48.9%

        \[\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. Simplified48.9%

      \[\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 72.4%

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

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

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

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

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

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

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

Alternative 2: 80.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ t_3 := e^{t\_2 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ t_4 := y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\ \mathbf{if}\;t\_3 \cdot \cos \left(t\_2 \cdot y.im + t\_1\right) \leq \infty:\\ \;\;\;\;t\_3 \cdot \left(\cos t\_4 - y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \sin t\_4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t\_0, y.im, t\_1\right)\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (hypot x.re x.im)))
        (t_1 (* y.re (atan2 x.im x.re)))
        (t_2 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
        (t_3 (exp (- (* t_2 y.re) (* (atan2 x.im x.re) y.im))))
        (t_4 (* y.im (log (hypot x.im x.re)))))
   (if (<= (* t_3 (cos (+ (* t_2 y.im) t_1))) INFINITY)
     (* t_3 (- (cos t_4) (* y.re (* (atan2 x.im x.re) (sin t_4)))))
     (*
      (exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
      (cos (fma t_0 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 = log(hypot(x_46_re, x_46_im));
	double t_1 = y_46_re * atan2(x_46_im, x_46_re);
	double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	double t_3 = exp(((t_2 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	double t_4 = y_46_im * log(hypot(x_46_im, x_46_re));
	double tmp;
	if ((t_3 * cos(((t_2 * y_46_im) + t_1))) <= ((double) INFINITY)) {
		tmp = t_3 * (cos(t_4) - (y_46_re * (atan2(x_46_im, x_46_re) * sin(t_4))));
	} else {
		tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_0, y_46_im, t_1));
	}
	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))
	t_1 = Float64(y_46_re * atan(x_46_im, x_46_re))
	t_2 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
	t_3 = exp(Float64(Float64(t_2 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
	t_4 = Float64(y_46_im * log(hypot(x_46_im, x_46_re)))
	tmp = 0.0
	if (Float64(t_3 * cos(Float64(Float64(t_2 * y_46_im) + t_1))) <= Inf)
		tmp = Float64(t_3 * Float64(cos(t_4) - Float64(y_46_re * Float64(atan(x_46_im, x_46_re) * sin(t_4)))));
	else
		tmp = Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_0, 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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(t$95$2 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Cos[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$3 * N[(N[Cos[t$95$4], $MachinePrecision] - N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * N[Sin[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(t$95$0 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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


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

    1. Initial program 76.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.re around 0 83.5%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv0.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-define0.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-define0.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-in0.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-out0.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-define0.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-define86.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. *-commutative86.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. Simplified86.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
  3. Recombined 2 regimes into one program.
  4. Final simplification85.0%

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

Alternative 3: 81.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ t_3 := e^{t\_2 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{if}\;t\_3 \cdot \cos \left(t\_2 \cdot y.im + t\_1\right) \leq \infty:\\ \;\;\;\;t\_3 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t\_0, y.im, t\_1\right)\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (hypot x.re x.im)))
        (t_1 (* y.re (atan2 x.im x.re)))
        (t_2 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
        (t_3 (exp (- (* t_2 y.re) (* (atan2 x.im x.re) y.im)))))
   (if (<= (* t_3 (cos (+ (* t_2 y.im) t_1))) INFINITY)
     (* t_3 (cos (* y.im (log (hypot x.im x.re)))))
     (*
      (exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
      (cos (fma t_0 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 = log(hypot(x_46_re, x_46_im));
	double t_1 = y_46_re * atan2(x_46_im, x_46_re);
	double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	double t_3 = exp(((t_2 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	double tmp;
	if ((t_3 * cos(((t_2 * y_46_im) + t_1))) <= ((double) INFINITY)) {
		tmp = t_3 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
	} else {
		tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_0, y_46_im, t_1));
	}
	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))
	t_1 = Float64(y_46_re * atan(x_46_im, x_46_re))
	t_2 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
	t_3 = exp(Float64(Float64(t_2 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
	tmp = 0.0
	if (Float64(t_3 * cos(Float64(Float64(t_2 * y_46_im) + t_1))) <= Inf)
		tmp = Float64(t_3 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))));
	else
		tmp = Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_0, 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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(t$95$2 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Cos[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$3 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(t$95$0 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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


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

    1. Initial program 76.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.re around 0 82.0%

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

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

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

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

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

    1. Initial program 0.0%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv0.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-define0.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-define0.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-in0.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-out0.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-define0.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-define86.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. *-commutative86.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. Simplified86.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
  3. Recombined 2 regimes into one program.
  4. Final simplification84.2%

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

Alternative 4: 77.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;y.re \leq 1.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{\cos \left({\left(\sqrt[3]{t\_0}\right)}^{3}\right)}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\

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


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

    1. Initial program 32.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.re around 0 40.6%

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

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

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

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

    if -2.40000000000000005e-16 < y.re < 1.8000000000000001e-15

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

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

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

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

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

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

        \[\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-define87.4%

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

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

      \[\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.re around 0 44.4%

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

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

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

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

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

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

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

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

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

    if 1.8000000000000001e-15 < y.re

    1. Initial program 36.5%

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

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

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

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

        \[\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-prod28.4%

        \[\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-define28.4%

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

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

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

      \[\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 66.4%

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

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

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

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

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

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

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

Alternative 5: 78.2% accurate, 1.1× speedup?

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

\mathbf{elif}\;y.re \leq 1.55 \cdot 10^{-15}:\\
\;\;\;\;\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^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\

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


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

    1. Initial program 32.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.re around 0 41.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.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
    4. Step-by-step derivation
      1. unpow241.4%

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

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

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

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

    if -0.0050000000000000001 < y.re < 1.5499999999999999e-15

    1. Initial program 43.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-inv43.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-define43.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-define43.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-in43.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-out43.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-define43.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-define86.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. *-commutative86.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. Simplified86.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.re around 0 85.6%

      \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \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) \]
    6. Step-by-step derivation
      1. neg-mul-185.6%

        \[\leadsto e^{\color{blue}{-y.im \cdot \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) \]
      2. *-commutative85.6%

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

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

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

    if 1.5499999999999999e-15 < y.re

    1. Initial program 36.5%

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

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

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

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

        \[\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-prod28.4%

        \[\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-define28.4%

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

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

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

      \[\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 66.4%

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

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

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

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

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

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

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

Alternative 6: 77.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -5.5 \cdot 10^{-14}:\\
\;\;\;\;\log \left({e}^{t\_0}\right)\\

\mathbf{elif}\;y.re \leq 1.65 \cdot 10^{-15}:\\
\;\;\;\;\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^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\

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


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

    1. Initial program 31.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. exp-diff28.6%

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

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

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

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

        \[\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-define28.6%

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

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

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

      \[\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 79.6%

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

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

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

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

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

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

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

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

      \[\leadsto \log \left({\color{blue}{\left(e^{1}\right)}}^{\left({\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\right)}\right) \]
    11. Step-by-step derivation
      1. exp-1-e84.4%

        \[\leadsto \log \left({\color{blue}{e}}^{\left({\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\right)}\right) \]
    12. Simplified84.4%

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

    if -5.49999999999999991e-14 < y.re < 1.65e-15

    1. Initial program 44.9%

      \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Step-by-step derivation
      1. cancel-sign-sub-inv44.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-define44.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-define44.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-in44.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-out44.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-define44.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-define87.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. *-commutative87.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. Simplified87.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.re around 0 87.7%

      \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \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) \]
    6. Step-by-step derivation
      1. neg-mul-187.7%

        \[\leadsto e^{\color{blue}{-y.im \cdot \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) \]
      2. *-commutative87.7%

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

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

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

    if 1.65e-15 < y.re

    1. Initial program 36.5%

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

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

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

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

        \[\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-prod28.4%

        \[\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-define28.4%

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

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

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

      \[\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 66.4%

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

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

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

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

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

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

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

Alternative 7: 77.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -2 \cdot 10^{-14}:\\
\;\;\;\;\log \left({e}^{t\_0}\right)\\

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

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


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

    1. Initial program 31.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. exp-diff28.6%

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

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

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

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

        \[\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-define28.6%

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

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

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

      \[\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 79.6%

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

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

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

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

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

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

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

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

      \[\leadsto \log \left({\color{blue}{\left(e^{1}\right)}}^{\left({\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\right)}\right) \]
    11. Step-by-step derivation
      1. exp-1-e84.4%

        \[\leadsto \log \left({\color{blue}{e}}^{\left({\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\right)}\right) \]
    12. Simplified84.4%

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

    if -2e-14 < y.re < 1.8000000000000001e-15

    1. Initial program 44.9%

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

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

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

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

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

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

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

      \[\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.re around 0 44.9%

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

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

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

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

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

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

    if 1.8000000000000001e-15 < y.re

    1. Initial program 36.5%

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

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

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

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

        \[\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-prod28.4%

        \[\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-define28.4%

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

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

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

      \[\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 66.4%

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

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

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

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

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

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

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

Alternative 8: 76.4% accurate, 2.0× speedup?

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

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

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

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


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

    1. Initial program 31.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. exp-diff28.6%

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

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

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

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

        \[\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-define28.6%

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

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

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

      \[\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 79.6%

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

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

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

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

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

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

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

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

      \[\leadsto \log \left({\color{blue}{\left(e^{1}\right)}}^{\left({\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\right)}\right) \]
    11. Step-by-step derivation
      1. exp-1-e84.4%

        \[\leadsto \log \left({\color{blue}{e}}^{\left({\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\right)}\right) \]
    12. Simplified84.4%

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

    if -9.99999999999999999e-15 < y.re < 1.8000000000000001e-15

    1. Initial program 44.9%

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

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

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

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

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

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

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

      \[\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.re around 0 44.9%

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

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

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

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

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

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

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

    if 1.8000000000000001e-15 < y.re

    1. Initial program 36.5%

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

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

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

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

        \[\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-prod28.4%

        \[\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-define28.4%

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

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

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

      \[\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 66.4%

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

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

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

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

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

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

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

Alternative 9: 76.4% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -1.1 \cdot 10^{-13} \lor \neg \left(y.re \leq 1.8 \cdot 10^{-15}\right):\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.re -1.1e-13) (not (<= y.re 1.8e-15)))
   (pow (hypot x.im x.re) y.re)
   (/ 1.0 (pow (exp 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_re <= -1.1e-13) || !(y_46_re <= 1.8e-15)) {
		tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
	} else {
		tmp = 1.0 / pow(exp(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_re <= -1.1e-13) || !(y_46_re <= 1.8e-15)) {
		tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
	} else {
		tmp = 1.0 / Math.pow(Math.exp(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_re <= -1.1e-13) or not (y_46_re <= 1.8e-15):
		tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
	else:
		tmp = 1.0 / math.pow(math.exp(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_re <= -1.1e-13) || !(y_46_re <= 1.8e-15))
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	else
		tmp = Float64(1.0 / (exp(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_re <= -1.1e-13) || ~((y_46_re <= 1.8e-15)))
		tmp = hypot(x_46_im, x_46_re) ^ y_46_re;
	else
		tmp = 1.0 / (exp(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[Or[LessEqual[y$46$re, -1.1e-13], N[Not[LessEqual[y$46$re, 1.8e-15]], $MachinePrecision]], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[(1.0 / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.1 \cdot 10^{-13} \lor \neg \left(y.re \leq 1.8 \cdot 10^{-15}\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -1.09999999999999998e-13 or 1.8000000000000001e-15 < y.re

    1. Initial program 34.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. exp-diff29.2%

        \[\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-pow29.2%

        \[\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-define29.2%

        \[\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. *-commutative29.2%

        \[\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-prod28.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-define28.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-define58.4%

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

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

      \[\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 72.5%

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

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

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

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

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

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

    if -1.09999999999999998e-13 < y.re < 1.8000000000000001e-15

    1. Initial program 44.9%

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

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

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

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

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

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

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

      \[\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.re around 0 44.9%

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

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

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

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

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

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

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

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

Alternative 10: 61.9% 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 39.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. exp-diff36.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-pow36.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-define36.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. *-commutative36.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-prod36.0%

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

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

      \[\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. *-commutative71.9%

      \[\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. Simplified71.9%

    \[\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 57.5%

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

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

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

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

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

    \[\leadsto \color{blue}{1} \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \]
  9. Final simplification69.7%

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

Alternative 11: 25.7% accurate, 7.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -2 \cdot 10^{-311}:\\ \;\;\;\;1 - y.re \cdot \log \left(\frac{-1}{x.im}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + y.re \cdot \log x.im\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= x.im -2e-311)
   (- 1.0 (* y.re (log (/ -1.0 x.im))))
   (+ 1.0 (* y.re (log x.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (x_46_im <= -2e-311) {
		tmp = 1.0 - (y_46_re * log((-1.0 / x_46_im)));
	} else {
		tmp = 1.0 + (y_46_re * log(x_46_im));
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if (x_46im <= (-2d-311)) then
        tmp = 1.0d0 - (y_46re * log(((-1.0d0) / x_46im)))
    else
        tmp = 1.0d0 + (y_46re * log(x_46im))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (x_46_im <= -2e-311) {
		tmp = 1.0 - (y_46_re * Math.log((-1.0 / x_46_im)));
	} else {
		tmp = 1.0 + (y_46_re * Math.log(x_46_im));
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if x_46_im <= -2e-311:
		tmp = 1.0 - (y_46_re * math.log((-1.0 / x_46_im)))
	else:
		tmp = 1.0 + (y_46_re * math.log(x_46_im))
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (x_46_im <= -2e-311)
		tmp = Float64(1.0 - Float64(y_46_re * log(Float64(-1.0 / x_46_im))));
	else
		tmp = Float64(1.0 + Float64(y_46_re * log(x_46_im)));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (x_46_im <= -2e-311)
		tmp = 1.0 - (y_46_re * log((-1.0 / x_46_im)));
	else
		tmp = 1.0 + (y_46_re * log(x_46_im));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, -2e-311], N[(1.0 - N[(y$46$re * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;1 + y.re \cdot \log x.im\\


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

    1. Initial program 36.9%

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

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

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

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

        \[\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-prod33.8%

        \[\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-define33.8%

        \[\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-define73.4%

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

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

      \[\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 56.5%

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

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

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    10. Simplified32.0%

      \[\leadsto \color{blue}{1 + y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    11. Taylor expanded in x.im around -inf 31.5%

      \[\leadsto 1 + \color{blue}{-1 \cdot \left(y.re \cdot \log \left(\frac{-1}{x.im}\right)\right)} \]
    12. Step-by-step derivation
      1. mul-1-neg31.5%

        \[\leadsto 1 + \color{blue}{\left(-y.re \cdot \log \left(\frac{-1}{x.im}\right)\right)} \]
      2. *-commutative31.5%

        \[\leadsto 1 + \left(-\color{blue}{\log \left(\frac{-1}{x.im}\right) \cdot y.re}\right) \]
      3. distribute-rgt-neg-in31.5%

        \[\leadsto 1 + \color{blue}{\log \left(\frac{-1}{x.im}\right) \cdot \left(-y.re\right)} \]
    13. Simplified31.5%

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

    if -1.9999999999999e-311 < x.im

    1. Initial program 42.0%

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

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

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

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

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

        \[\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. *-commutative70.1%

        \[\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. Simplified70.1%

      \[\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 58.7%

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

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

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    10. Simplified29.2%

      \[\leadsto \color{blue}{1 + y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    11. Taylor expanded in x.re around 0 29.1%

      \[\leadsto 1 + \color{blue}{y.re \cdot \log x.im} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -2 \cdot 10^{-311}:\\ \;\;\;\;1 - y.re \cdot \log \left(\frac{-1}{x.im}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + y.re \cdot \log x.im\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 19.3% accurate, 7.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -9 \cdot 10^{-289}:\\ \;\;\;\;1 + y.re \cdot \log x.re\\ \mathbf{else}:\\ \;\;\;\;1 + y.re \cdot \log x.im\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= x.im -9e-289)
   (+ 1.0 (* y.re (log x.re)))
   (+ 1.0 (* y.re (log x.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (x_46_im <= -9e-289) {
		tmp = 1.0 + (y_46_re * log(x_46_re));
	} else {
		tmp = 1.0 + (y_46_re * log(x_46_im));
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if (x_46im <= (-9d-289)) then
        tmp = 1.0d0 + (y_46re * log(x_46re))
    else
        tmp = 1.0d0 + (y_46re * log(x_46im))
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (x_46_im <= -9e-289) {
		tmp = 1.0 + (y_46_re * Math.log(x_46_re));
	} else {
		tmp = 1.0 + (y_46_re * Math.log(x_46_im));
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if x_46_im <= -9e-289:
		tmp = 1.0 + (y_46_re * math.log(x_46_re))
	else:
		tmp = 1.0 + (y_46_re * math.log(x_46_im))
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (x_46_im <= -9e-289)
		tmp = Float64(1.0 + Float64(y_46_re * log(x_46_re)));
	else
		tmp = Float64(1.0 + Float64(y_46_re * log(x_46_im)));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (x_46_im <= -9e-289)
		tmp = 1.0 + (y_46_re * log(x_46_re));
	else
		tmp = 1.0 + (y_46_re * log(x_46_im));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, -9e-289], N[(1.0 + N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -9 \cdot 10^{-289}:\\
\;\;\;\;1 + y.re \cdot \log x.re\\

\mathbf{else}:\\
\;\;\;\;1 + y.re \cdot \log x.im\\


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

    1. Initial program 36.9%

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

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

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

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

        \[\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-prod33.9%

        \[\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-define33.9%

        \[\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-define72.8%

        \[\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. *-commutative72.8%

        \[\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. Simplified72.8%

      \[\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 56.3%

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

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

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    10. Simplified31.9%

      \[\leadsto \color{blue}{1 + y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    11. Taylor expanded in x.im around 0 13.2%

      \[\leadsto 1 + \color{blue}{y.re \cdot \log x.re} \]

    if -9.0000000000000003e-289 < x.im

    1. Initial program 41.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. Step-by-step derivation
      1. exp-diff38.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-pow38.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-define38.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. *-commutative38.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-prod38.4%

        \[\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-define38.4%

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

        \[\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. *-commutative70.9%

        \[\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. Simplified70.9%

      \[\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 58.9%

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

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

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    10. Simplified29.4%

      \[\leadsto \color{blue}{1 + y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
    11. Taylor expanded in x.re around 0 28.4%

      \[\leadsto 1 + \color{blue}{y.re \cdot \log x.im} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification20.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -9 \cdot 10^{-289}:\\ \;\;\;\;1 + y.re \cdot \log x.re\\ \mathbf{else}:\\ \;\;\;\;1 + y.re \cdot \log x.im\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 13.0% accurate, 7.9× speedup?

\[\begin{array}{l} \\ 1 + y.re \cdot \log x.im \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (+ 1.0 (* y.re (log x.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return 1.0 + (y_46_re * log(x_46_im));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = 1.0d0 + (y_46re * log(x_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return 1.0 + (y_46_re * Math.log(x_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return 1.0 + (y_46_re * math.log(x_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(1.0 + Float64(y_46_re * log(x_46_im)))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 1.0 + (y_46_re * log(x_46_im));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 + N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + y.re \cdot \log x.im
\end{array}
Derivation
  1. Initial program 39.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. exp-diff36.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-pow36.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-define36.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. *-commutative36.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-prod36.0%

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

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

      \[\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. *-commutative71.9%

      \[\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. Simplified71.9%

    \[\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 57.5%

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

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

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

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

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

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

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

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

      \[\leadsto 1 + y.re \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
  10. Simplified30.7%

    \[\leadsto \color{blue}{1 + y.re \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \]
  11. Taylor expanded in x.re around 0 13.3%

    \[\leadsto 1 + \color{blue}{y.re \cdot \log x.im} \]
  12. Final simplification13.3%

    \[\leadsto 1 + y.re \cdot \log x.im \]
  13. Add Preprocessing

Reproduce

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