powComplex, real part

Percentage Accurate: 40.1% → 80.9%
Time: 15.2s
Alternatives: 6
Speedup: 2.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 80.9% accurate, 0.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t_0, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}^{3}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < 1.99999999999999996e-120

    1. Initial program 45.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. Simplified85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.99999999999999996e-120 < y.im

      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. Simplified79.8%

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

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

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

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

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

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

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

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

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

      Alternative 2: 80.6% accurate, 0.9× speedup?

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

        1. Initial program 43.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1.5000000000000001e-253 < x.im

          1. Initial program 47.6%

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

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

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

          Alternative 3: 81.5% accurate, 0.9× speedup?

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

            1. Initial program 43.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 1.0000000000000001e-250 < x.im

              1. Initial program 47.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 4: 81.2% accurate, 1.2× speedup?

              \[\begin{array}{l} \\ e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \end{array} \]
              (FPCore (x.re x.im y.re y.im)
               :precision binary64
               (*
                (exp (- (* (log (hypot x.re x.im)) y.re) (* y.im (atan2 x.im x.re))))
                (cos (* y.im (log (hypot x.im x.re))))))
              double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
              	return exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * atan2(x_46_im, x_46_re)))) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
              }
              
              public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
              	return Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * Math.atan2(x_46_im, x_46_re)))) * Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
              }
              
              def code(x_46_re, x_46_im, y_46_re, y_46_im):
              	return math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * math.atan2(x_46_im, x_46_re)))) * math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re))))
              
              function code(x_46_re, x_46_im, y_46_re, y_46_im)
              	return Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))))
              end
              
              function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
              	tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * atan2(x_46_im, x_46_re)))) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
              end
              
              code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)
              \end{array}
              
              Derivation
              1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 5: 81.2% accurate, 1.3× speedup?

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

                  1. Initial program 51.6%

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

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

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

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

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

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

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

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

                    if -2.5999999999999999e-299 < x.re

                    1. Initial program 38.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. Simplified81.4%

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

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

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

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

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

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

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

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

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

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

                    Alternative 6: 81.4% accurate, 2.0× speedup?

                    \[\begin{array}{l} \\ e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \end{array} \]
                    (FPCore (x.re x.im y.re y.im)
                     :precision binary64
                     (exp (- (* (log (hypot x.re x.im)) y.re) (* 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) {
                    	return exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * atan2(x_46_im, x_46_re))));
                    }
                    
                    public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
                    	return Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * Math.atan2(x_46_im, x_46_re))));
                    }
                    
                    def code(x_46_re, x_46_im, y_46_re, y_46_im):
                    	return math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * math.atan2(x_46_im, x_46_re))))
                    
                    function code(x_46_re, x_46_im, y_46_re, y_46_im)
                    	return exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(y_46_im * atan(x_46_im, x_46_re))))
                    end
                    
                    function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
                    	tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (y_46_im * atan2(x_46_im, x_46_re))));
                    end
                    
                    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}
                    \end{array}
                    
                    Derivation
                    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

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

                      Reproduce

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