powComplex, real part

Percentage Accurate: 40.8% → 74.9%
Time: 12.0s
Alternatives: 13
Speedup: 2.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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    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.8% 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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    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: 74.9% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;y.im \leq 4.4 \cdot 10^{-29}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.45e60 or 5.6e231 < y.im

    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. Add Preprocessing
    3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
      2. lower-*.f64N/A

        \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
      3. lower-log.f64N/A

        \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
      4. unpow2N/A

        \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
      5. unpow2N/A

        \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
      6. lower-hypot.f6465.8

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

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

      \[\leadsto \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right) \]
    7. Step-by-step derivation
      1. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

    if -1.45e60 < y.im < 4.39999999999999981e-29

    1. Initial program 36.1%

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

      \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
    4. Step-by-step derivation
      1. lower-pow.f64N/A

        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
      2. unpow2N/A

        \[\leadsto {\left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)}^{y.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) \]
      3. unpow2N/A

        \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.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) \]
      4. lower-hypot.f6436.1

        \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.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. Applied rewrites36.1%

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

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

        \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
      2. lower-*.f64N/A

        \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
      3. lower-log.f64N/A

        \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
      4. unpow2N/A

        \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
      5. unpow2N/A

        \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
      6. lower-hypot.f6493.1

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

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

    if 4.39999999999999981e-29 < y.im < 5.6e231

    1. Initial program 31.5%

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

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

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

        \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
      3. lower-*.f64N/A

        \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
      4. lower-atan2.f6465.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(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
    5. Applied rewrites65.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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 60.8% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.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)))) < -0.5

    1. Initial program 32.1%

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

      \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
    4. Step-by-step derivation
      1. lower-pow.f64N/A

        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
      2. unpow2N/A

        \[\leadsto {\left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)}^{y.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) \]
      3. unpow2N/A

        \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.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) \]
      4. lower-hypot.f6428.6

        \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.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. Applied rewrites28.6%

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

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

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

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

        \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \color{blue}{\left(\mathsf{fma}\left(\frac{{x.im}^{2}}{x.re}, \frac{1}{2}, x.re\right)\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      4. lower-/.f64N/A

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

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

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

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

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

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

        \[\leadsto {x.re}^{y.re} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto {x.re}^{y.re} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
        2. lower-log.f64N/A

          \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}\right) \]
        3. +-commutativeN/A

          \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\sqrt{\color{blue}{{x.re}^{2} + {x.im}^{2}}}\right)\right) \]
        4. unpow2N/A

          \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\sqrt{\color{blue}{x.re \cdot x.re} + {x.im}^{2}}\right)\right) \]
        5. unpow2N/A

          \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)\right) \]
        6. lower-hypot.f6437.6

          \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}\right) \]
      4. Applied rewrites37.6%

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

      if -0.5 < (*.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 36.4%

        \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6467.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(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im\right) \]
      5. Applied rewrites67.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 \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)} \]
      6. Taylor expanded in y.im around 0

        \[\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}} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

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

          \[\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} \]
        3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

    Alternative 3: 79.8% accurate, 1.0× speedup?

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

      1. Initial program 33.6%

        \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6481.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(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im\right) \]
      5. Applied rewrites81.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 \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)} \]

      if -0.0015 < y.re < 0.104999999999999996

      1. Initial program 38.6%

        \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6450.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 78.2% accurate, 1.2× speedup?

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

      1. Initial program 39.4%

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

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

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

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        3. lower-*.f64N/A

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        4. lower-atan2.f6483.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(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
      5. Applied rewrites83.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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]

      if -5e-32 < y.re < 0.017500000000000002

      1. Initial program 38.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. Add Preprocessing
      3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6451.7

          \[\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(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im\right) \]
      5. Applied rewrites51.7%

        \[\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 \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)} \]
      6. Taylor expanded in x.im around -inf

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

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

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

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

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

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

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

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

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

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

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

      if 0.017500000000000002 < y.re

      1. Initial program 28.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. Add Preprocessing
      3. Taylor expanded in y.im around 0

        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
      4. Step-by-step derivation
        1. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
        2. unpow2N/A

          \[\leadsto {\left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)}^{y.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) \]
        3. unpow2N/A

          \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.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) \]
        4. lower-hypot.f6424.0

          \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.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. Applied rewrites24.0%

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

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

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6470.6

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im\right) \]
      8. Applied rewrites70.6%

        \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)} \]
    3. Recombined 3 regimes into one program.
    4. Add Preprocessing

    Alternative 5: 77.6% accurate, 1.3× speedup?

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

      1. Initial program 33.1%

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

        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
      4. Step-by-step derivation
        1. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
        2. unpow2N/A

          \[\leadsto {\left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)}^{y.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) \]
        3. unpow2N/A

          \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.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) \]
        4. lower-hypot.f6429.2

          \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.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. Applied rewrites29.2%

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

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

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6477.3

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im\right) \]
      8. Applied rewrites77.3%

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

      if -1.25e11 < y.re < 0.017500000000000002

      1. Initial program 38.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. Add Preprocessing
      3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6451.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(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im\right) \]
      5. Applied rewrites51.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 \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)} \]
      6. Taylor expanded in x.im around -inf

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 74.3% accurate, 1.3× speedup?

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

      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. Add Preprocessing
      3. Taylor expanded in y.im around 0

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

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

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        3. lower-*.f64N/A

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        4. lower-atan2.f6457.1

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
      6. Step-by-step derivation
        1. lift-exp.f64N/A

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

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. fp-cancel-sub-sign-invN/A

          \[\leadsto e^{\color{blue}{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re + \left(\mathsf{neg}\left(\tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot y.im}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        5. fp-cancel-sign-sub-invN/A

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

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

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

        \[\leadsto \color{blue}{\frac{1}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. distribute-lft-neg-inN/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        3. lower-exp.f64N/A

          \[\leadsto \color{blue}{e^{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. lower-*.f64N/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        5. lower-neg.f64N/A

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

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

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

      if -7.8000000000000004e33 < y.im < 5.5000000000000003e81

      1. Initial program 37.3%

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

        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
      4. Step-by-step derivation
        1. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
        2. unpow2N/A

          \[\leadsto {\left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)}^{y.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) \]
        3. unpow2N/A

          \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.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) \]
        4. lower-hypot.f6436.8

          \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.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. Applied rewrites36.8%

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

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

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6490.1

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

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

      if 5.5000000000000003e81 < y.im

      1. Initial program 29.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. Add Preprocessing
      3. Taylor expanded in y.im around 0

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

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

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        3. lower-*.f64N/A

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        4. lower-atan2.f6463.3

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

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

        \[\leadsto \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      7. Step-by-step derivation
        1. distribute-lft-neg-inN/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. exp-prodN/A

          \[\leadsto \color{blue}{{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        3. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. lower-exp.f64N/A

          \[\leadsto {\color{blue}{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        5. lower-neg.f64N/A

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

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

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

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

    Alternative 7: 74.1% accurate, 1.3× speedup?

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

      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. Add Preprocessing
      3. Taylor expanded in y.im around 0

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

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

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        3. lower-*.f64N/A

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        4. lower-atan2.f6459.9

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
      6. Step-by-step derivation
        1. lift-exp.f64N/A

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

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. fp-cancel-sub-sign-invN/A

          \[\leadsto e^{\color{blue}{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re + \left(\mathsf{neg}\left(\tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot y.im}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        5. fp-cancel-sign-sub-invN/A

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

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

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

        \[\leadsto \color{blue}{\frac{1}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. distribute-lft-neg-inN/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        3. lower-exp.f64N/A

          \[\leadsto \color{blue}{e^{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. lower-*.f64N/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        5. lower-neg.f64N/A

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

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

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

      if -7.8000000000000004e33 < y.im < 5.5000000000000003e81

      1. Initial program 37.3%

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

        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
      4. Step-by-step derivation
        1. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
        2. unpow2N/A

          \[\leadsto {\left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)}^{y.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) \]
        3. unpow2N/A

          \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.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) \]
        4. lower-hypot.f6436.8

          \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.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. Applied rewrites36.8%

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

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

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6490.1

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

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

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

    Alternative 8: 72.0% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -5.2 \cdot 10^{+35} \lor \neg \left(y.im \leq 8 \cdot 10^{+75}\right):\\ \;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (or (<= y.im -5.2e+35) (not (<= y.im 8e+75)))
       (* (exp (* (- y.im) (atan2 x.im x.re))) (cos (* (atan2 x.im x.re) y.re)))
       (*
        (sin (fma 0.5 (PI) (* y.re (atan2 x.im x.re))))
        (pow (hypot x.re x.im) y.re))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.im \leq -5.2 \cdot 10^{+35} \lor \neg \left(y.im \leq 8 \cdot 10^{+75}\right):\\
    \;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\sin \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.im < -5.20000000000000013e35 or 7.99999999999999941e75 < y.im

      1. Initial program 34.1%

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

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

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

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        3. lower-*.f64N/A

          \[\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 \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        4. lower-atan2.f6459.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(\color{blue}{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.re\right) \]
      5. Applied rewrites59.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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
      6. Step-by-step derivation
        1. lift-exp.f64N/A

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

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. fp-cancel-sub-sign-invN/A

          \[\leadsto e^{\color{blue}{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re + \left(\mathsf{neg}\left(\tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot y.im}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        5. fp-cancel-sign-sub-invN/A

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

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

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

        \[\leadsto \color{blue}{\frac{1}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. distribute-lft-neg-inN/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        3. lower-exp.f64N/A

          \[\leadsto \color{blue}{e^{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. lower-*.f64N/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        5. lower-neg.f64N/A

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

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

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

      if -5.20000000000000013e35 < y.im < 7.99999999999999941e75

      1. Initial program 37.4%

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

        \[\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(\log \color{blue}{\left(-1 \cdot x.im\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\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(\log \color{blue}{\left(\mathsf{neg}\left(x.im\right)\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. lower-neg.f6436.3

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

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

          \[\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(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        2. sin-+PI/2-revN/A

          \[\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}{\sin \left(\left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        3. lower-sin.f64N/A

          \[\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}{\sin \left(\left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        4. lift-+.f64N/A

          \[\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 \sin \left(\color{blue}{\left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} + \frac{\mathsf{PI}\left(\right)}{2}\right) \]
        5. associate-+l+N/A

          \[\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 \sin \color{blue}{\left(\log \left(-x.im\right) \cdot y.im + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        6. lift-*.f64N/A

          \[\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 \sin \left(\color{blue}{\log \left(-x.im\right) \cdot y.im} + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \]
        7. lower-fma.f64N/A

          \[\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 \sin \color{blue}{\left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        8. lift-*.f64N/A

          \[\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 \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re} + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \]
        9. lower-fma.f64N/A

          \[\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 \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \color{blue}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)}\right)\right) \]
        10. lower-/.f64N/A

          \[\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 \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right)\right)\right) \]
        11. lower-PI.f6437.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 \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\color{blue}{\mathsf{PI}\left(\right)}}{2}\right)\right)\right) \]
      7. Applied rewrites37.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}{\sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)} \]
      8. Taylor expanded in y.re around 0

        \[\leadsto \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
      9. Step-by-step derivation
        1. distribute-lft-neg-inN/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        2. exp-prodN/A

          \[\leadsto \color{blue}{{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        3. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        4. lower-exp.f64N/A

          \[\leadsto {\color{blue}{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        5. lower-neg.f64N/A

          \[\leadsto {\left(e^{\color{blue}{-y.im}}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        6. lower-atan2.f6420.3

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

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

        \[\leadsto \color{blue}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}} \]
      12. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}} \]
        2. lower-sin.f64N/A

          \[\leadsto \color{blue}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        3. lower-fma.f64N/A

          \[\leadsto \sin \color{blue}{\left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        4. lower-PI.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\mathsf{PI}\left(\right)}, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        5. lower-*.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), \color{blue}{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        6. lower-atan2.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        7. lower-pow.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}} \]
        8. +-commutativeN/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{\color{blue}{{x.re}^{2} + {x.im}^{2}}}\right)}^{y.re} \]
        9. unpow2N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{\color{blue}{x.re \cdot x.re} + {x.im}^{2}}\right)}^{y.re} \]
        10. unpow2N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \]
        11. lower-hypot.f6483.8

          \[\leadsto \sin \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re} \]
      13. Applied rewrites83.8%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -5.2 \cdot 10^{+35} \lor \neg \left(y.im \leq 8 \cdot 10^{+75}\right):\\ \;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 60.7% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \leq 1.6 \cdot 10^{-131}:\\ \;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (<= x.re 1.6e-131)
       (* (cos (* (atan2 x.im x.re) y.re)) (pow (hypot x.im x.re) y.re))
       (*
        (sin (fma 0.5 (PI) (* y.re (atan2 x.im x.re))))
        (pow (hypot x.re x.im) y.re))))
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x.re \leq 1.6 \cdot 10^{-131}:\\
    \;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;\sin \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x.re < 1.6e-131

      1. Initial program 39.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. Add Preprocessing
      3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        2. lower-*.f64N/A

          \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
        3. lower-log.f64N/A

          \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
        4. unpow2N/A

          \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
        5. unpow2N/A

          \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
        6. lower-hypot.f6467.8

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

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

        \[\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}} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

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

          \[\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} \]
        3. *-commutativeN/A

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

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

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

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

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

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

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

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

      if 1.6e-131 < x.re

      1. Initial program 29.0%

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

        \[\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(\log \color{blue}{\left(-1 \cdot x.im\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\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(\log \color{blue}{\left(\mathsf{neg}\left(x.im\right)\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. lower-neg.f6426.7

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

        \[\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(\log \color{blue}{\left(-x.im\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      6. Step-by-step derivation
        1. lift-cos.f64N/A

          \[\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(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \]
        2. sin-+PI/2-revN/A

          \[\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}{\sin \left(\left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        3. lower-sin.f64N/A

          \[\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}{\sin \left(\left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        4. lift-+.f64N/A

          \[\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 \sin \left(\color{blue}{\left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} + \frac{\mathsf{PI}\left(\right)}{2}\right) \]
        5. associate-+l+N/A

          \[\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 \sin \color{blue}{\left(\log \left(-x.im\right) \cdot y.im + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        6. lift-*.f64N/A

          \[\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 \sin \left(\color{blue}{\log \left(-x.im\right) \cdot y.im} + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \]
        7. lower-fma.f64N/A

          \[\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 \sin \color{blue}{\left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)} \]
        8. lift-*.f64N/A

          \[\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 \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \color{blue}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re} + \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \]
        9. lower-fma.f64N/A

          \[\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 \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \color{blue}{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)}\right)\right) \]
        10. lower-/.f64N/A

          \[\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 \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right)\right)\right) \]
        11. lower-PI.f6431.1

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)} \]
      8. Taylor expanded in y.re around 0

        \[\leadsto \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
      9. Step-by-step derivation
        1. distribute-lft-neg-inN/A

          \[\leadsto e^{\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        2. exp-prodN/A

          \[\leadsto \color{blue}{{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        3. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        4. lower-exp.f64N/A

          \[\leadsto {\color{blue}{\left(e^{\mathsf{neg}\left(y.im\right)}\right)}}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        5. lower-neg.f64N/A

          \[\leadsto {\left(e^{\color{blue}{-y.im}}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \]
        6. lower-atan2.f6417.3

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

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

        \[\leadsto \color{blue}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}} \]
      12. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}} \]
        2. lower-sin.f64N/A

          \[\leadsto \color{blue}{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        3. lower-fma.f64N/A

          \[\leadsto \sin \color{blue}{\left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        4. lower-PI.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \color{blue}{\mathsf{PI}\left(\right)}, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        5. lower-*.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), \color{blue}{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        6. lower-atan2.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \cdot {\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \]
        7. lower-pow.f64N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}} \]
        8. +-commutativeN/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{\color{blue}{{x.re}^{2} + {x.im}^{2}}}\right)}^{y.re} \]
        9. unpow2N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{\color{blue}{x.re \cdot x.re} + {x.im}^{2}}\right)}^{y.re} \]
        10. unpow2N/A

          \[\leadsto \sin \left(\mathsf{fma}\left(\frac{1}{2}, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)}^{y.re} \]
        11. lower-hypot.f6460.1

          \[\leadsto \sin \left(\mathsf{fma}\left(0.5, \mathsf{PI}\left(\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot {\color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}^{y.re} \]
      13. Applied rewrites60.1%

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

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

    Alternative 10: 53.3% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -0.00065 \lor \neg \left(y.re \leq 85000000000000\right):\\ \;\;\;\;{x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right)\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (or (<= y.re -0.00065) (not (<= y.re 85000000000000.0)))
       (* (pow x.re y.re) (cos (* y.im (log (hypot x.re x.im)))))
       (fma (log (hypot x.im x.re)) y.re 1.0)))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double tmp;
    	if ((y_46_re <= -0.00065) || !(y_46_re <= 85000000000000.0)) {
    		tmp = pow(x_46_re, y_46_re) * cos((y_46_im * log(hypot(x_46_re, x_46_im))));
    	} else {
    		tmp = fma(log(hypot(x_46_im, x_46_re)), y_46_re, 1.0);
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	tmp = 0.0
    	if ((y_46_re <= -0.00065) || !(y_46_re <= 85000000000000.0))
    		tmp = Float64((x_46_re ^ y_46_re) * cos(Float64(y_46_im * log(hypot(x_46_re, x_46_im)))));
    	else
    		tmp = fma(log(hypot(x_46_im, x_46_re)), y_46_re, 1.0);
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -0.00065], N[Not[LessEqual[y$46$re, 85000000000000.0]], $MachinePrecision]], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + 1.0), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.re \leq -0.00065 \lor \neg \left(y.re \leq 85000000000000\right):\\
    \;\;\;\;{x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.re < -6.4999999999999997e-4 or 8.5e13 < y.re

      1. Initial program 34.1%

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

        \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
      4. Step-by-step derivation
        1. lower-pow.f64N/A

          \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.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) \]
        2. unpow2N/A

          \[\leadsto {\left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right)}^{y.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) \]
        3. unpow2N/A

          \[\leadsto {\left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right)}^{y.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) \]
        4. lower-hypot.f6428.8

          \[\leadsto {\color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}}^{y.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. Applied rewrites28.8%

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

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

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

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

          \[\leadsto {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\log \color{blue}{\left(\mathsf{fma}\left(\frac{{x.im}^{2}}{x.re}, \frac{1}{2}, x.re\right)\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        4. lower-/.f64N/A

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

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

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

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

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

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

          \[\leadsto {x.re}^{y.re} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto {x.re}^{y.re} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
          2. lower-log.f64N/A

            \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}\right) \]
          3. +-commutativeN/A

            \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\sqrt{\color{blue}{{x.re}^{2} + {x.im}^{2}}}\right)\right) \]
          4. unpow2N/A

            \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\sqrt{\color{blue}{x.re \cdot x.re} + {x.im}^{2}}\right)\right) \]
          5. unpow2N/A

            \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + \color{blue}{x.im \cdot x.im}}\right)\right) \]
          6. lower-hypot.f6455.5

            \[\leadsto {x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}\right) \]
        4. Applied rewrites55.5%

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

        if -6.4999999999999997e-4 < y.re < 8.5e13

        1. Initial program 38.0%

          \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. Add Preprocessing
        3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
          2. lower-*.f64N/A

            \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
          3. lower-log.f64N/A

            \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
          4. unpow2N/A

            \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
          5. unpow2N/A

            \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
          6. lower-hypot.f6450.9

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

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

          \[\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}} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

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

            \[\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} \]
          3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), \color{blue}{y.re}, 1\right) \]
        11. Recombined 2 regimes into one program.
        12. Final simplification50.3%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -0.00065 \lor \neg \left(y.re \leq 85000000000000\right):\\ \;\;\;\;{x.re}^{y.re} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right)\\ \end{array} \]
        13. Add Preprocessing

        Alternative 11: 50.8% accurate, 2.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -92000 \lor \neg \left(y.re \leq 1.1 \cdot 10^{-6}\right):\\ \;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot {x.im}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right)\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (if (or (<= y.re -92000.0) (not (<= y.re 1.1e-6)))
           (* (cos (* (atan2 x.im x.re) y.re)) (pow x.im y.re))
           (fma (log (hypot x.im x.re)) y.re 1.0)))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double tmp;
        	if ((y_46_re <= -92000.0) || !(y_46_re <= 1.1e-6)) {
        		tmp = cos((atan2(x_46_im, x_46_re) * y_46_re)) * pow(x_46_im, y_46_re);
        	} else {
        		tmp = fma(log(hypot(x_46_im, x_46_re)), y_46_re, 1.0);
        	}
        	return tmp;
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	tmp = 0.0
        	if ((y_46_re <= -92000.0) || !(y_46_re <= 1.1e-6))
        		tmp = Float64(cos(Float64(atan(x_46_im, x_46_re) * y_46_re)) * (x_46_im ^ y_46_re));
        	else
        		tmp = fma(log(hypot(x_46_im, x_46_re)), y_46_re, 1.0);
        	end
        	return tmp
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -92000.0], N[Not[LessEqual[y$46$re, 1.1e-6]], $MachinePrecision]], N[(N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision] * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + 1.0), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y.re \leq -92000 \lor \neg \left(y.re \leq 1.1 \cdot 10^{-6}\right):\\
        \;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot {x.im}^{y.re}\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y.re < -92000 or 1.1000000000000001e-6 < y.re

          1. Initial program 34.1%

            \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
          2. Add Preprocessing
          3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
            2. lower-*.f64N/A

              \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
            3. lower-log.f64N/A

              \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
            4. unpow2N/A

              \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
            5. unpow2N/A

              \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
            6. lower-hypot.f6480.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(\log \color{blue}{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)} \cdot y.im\right) \]
          5. Applied rewrites80.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 \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)} \]
          6. Taylor expanded in y.im around 0

            \[\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}} \]
          7. Step-by-step derivation
            1. lower-*.f64N/A

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

              \[\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} \]
            3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

            if -92000 < y.re < 1.1000000000000001e-6

            1. Initial program 38.1%

              \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
            2. Add Preprocessing
            3. Taylor expanded in y.re around 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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
              2. lower-*.f64N/A

                \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
              3. lower-log.f64N/A

                \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
              4. unpow2N/A

                \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
              5. unpow2N/A

                \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
              6. lower-hypot.f6451.3

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

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

              \[\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}} \]
            7. Step-by-step derivation
              1. lower-*.f64N/A

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

                \[\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} \]
              3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), \color{blue}{y.re}, 1\right) \]
            11. Recombined 2 regimes into one program.
            12. Final simplification49.7%

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

            Alternative 12: 27.4% accurate, 3.3× speedup?

            \[\begin{array}{l} \\ \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right) \end{array} \]
            (FPCore (x.re x.im y.re y.im)
             :precision binary64
             (fma (log (hypot x.im x.re)) y.re 1.0))
            double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
            	return fma(log(hypot(x_46_im, x_46_re)), y_46_re, 1.0);
            }
            
            function code(x_46_re, x_46_im, y_46_re, y_46_im)
            	return fma(log(hypot(x_46_im, x_46_re)), y_46_re, 1.0)
            end
            
            code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + 1.0), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right)
            \end{array}
            
            Derivation
            1. Initial program 36.0%

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

              \[\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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
              2. lower-*.f64N/A

                \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
              3. lower-log.f64N/A

                \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
              4. unpow2N/A

                \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
              5. unpow2N/A

                \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
              6. lower-hypot.f6466.3

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

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

              \[\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}} \]
            7. Step-by-step derivation
              1. lower-*.f64N/A

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

                \[\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} \]
              3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), \color{blue}{y.re}, 1\right) \]
              2. Final simplification23.8%

                \[\leadsto \mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re, 1\right) \]
              3. Add Preprocessing

              Alternative 13: 26.9% accurate, 680.0× speedup?

              \[\begin{array}{l} \\ 1 \end{array} \]
              (FPCore (x.re x.im y.re y.im) :precision binary64 1.0)
              double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
              	return 1.0;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x_46re, x_46im, y_46re, y_46im)
              use fmin_fmax_functions
                  real(8), intent (in) :: x_46re
                  real(8), intent (in) :: x_46im
                  real(8), intent (in) :: y_46re
                  real(8), intent (in) :: y_46im
                  code = 1.0d0
              end function
              
              public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
              	return 1.0;
              }
              
              def code(x_46_re, x_46_im, y_46_re, y_46_im):
              	return 1.0
              
              function code(x_46_re, x_46_im, y_46_re, y_46_im)
              	return 1.0
              end
              
              function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
              	tmp = 1.0;
              end
              
              code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 1.0
              
              \begin{array}{l}
              
              \\
              1
              \end{array}
              
              Derivation
              1. Initial program 36.0%

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

                \[\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 \color{blue}{\left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

                  \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
                2. lower-*.f64N/A

                  \[\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 \color{blue}{\left(\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right) \cdot y.im\right)} \]
                3. lower-log.f64N/A

                  \[\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(\color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)} \cdot y.im\right) \]
                4. unpow2N/A

                  \[\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(\log \left(\sqrt{\color{blue}{x.im \cdot x.im} + {x.re}^{2}}\right) \cdot y.im\right) \]
                5. unpow2N/A

                  \[\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(\log \left(\sqrt{x.im \cdot x.im + \color{blue}{x.re \cdot x.re}}\right) \cdot y.im\right) \]
                6. lower-hypot.f6466.3

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

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

                \[\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}} \]
              7. Step-by-step derivation
                1. lower-*.f64N/A

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

                  \[\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} \]
                3. *-commutativeN/A

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

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

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

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

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

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

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

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

                \[\leadsto 1 \]
              10. Step-by-step derivation
                1. Applied rewrites23.5%

                  \[\leadsto 1 \]
                2. Final simplification23.5%

                  \[\leadsto 1 \]
                3. Add Preprocessing

                Reproduce

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