powComplex, imaginary part

Percentage Accurate: 40.3% → 77.2%
Time: 15.4s
Alternatives: 8
Speedup: N/A×

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 \sin \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)))
    (sin (+ (* 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))) * sin(((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))) * sin(((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.sin(((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.sin(((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))) * sin(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))) * sin(((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[Sin[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 \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}

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 8 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.3% 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 \sin \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)))
    (sin (+ (* 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))) * sin(((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))) * sin(((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.sin(((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.sin(((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))) * sin(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))) * sin(((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[Sin[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 \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}

Alternative 1: 77.2% accurate, N/A× speedup?

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

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

\mathbf{elif}\;y.re \leq 2.1:\\
\;\;\;\;\frac{e^{t\_2 \cdot y.re}}{e^{t\_0}} \cdot \sin \left(\mathsf{fma}\left(t\_2, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -6.99999999999999999e25 or 2.10000000000000009 < y.re

    1. Initial program 38.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 \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Taylor expanded in y.re 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 \sin \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Step-by-step derivation
      1. 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(y.re \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}}\right) \]
      2. lift-atan2.f6471.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 \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{\color{blue}{x.re}}\right) \]
    4. Applied rewrites71.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 \sin \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]

    if -6.99999999999999999e25 < y.re < 2.10000000000000009

    1. Initial program 42.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 \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
    2. Step-by-step derivation
      1. Applied rewrites82.8%

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

    Alternative 2: 76.6% accurate, N/A× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_1 := e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_0} \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;y.re \leq -3.7 \cdot 10^{-12}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq 9.5 \cdot 10^{-17}:\\ \;\;\;\;\frac{1}{e^{t\_0}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (* (atan2 x.im x.re) y.im))
            (t_1
             (*
              (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_0))
              (sin (* y.re (atan2 x.im x.re))))))
       (if (<= y.re -3.7e-12)
         t_1
         (if (<= y.re 9.5e-17)
           (*
            (/ 1.0 (exp t_0))
            (sin (fma (log (hypot x.re x.im)) y.im (* (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 = atan2(x_46_im, x_46_re) * y_46_im;
    	double t_1 = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * sin((y_46_re * atan2(x_46_im, x_46_re)));
    	double tmp;
    	if (y_46_re <= -3.7e-12) {
    		tmp = t_1;
    	} else if (y_46_re <= 9.5e-17) {
    		tmp = (1.0 / exp(t_0)) * sin(fma(log(hypot(x_46_re, x_46_im)), y_46_im, (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 = Float64(atan(x_46_im, x_46_re) * y_46_im)
    	t_1 = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - t_0)) * sin(Float64(y_46_re * atan(x_46_im, x_46_re))))
    	tmp = 0.0
    	if (y_46_re <= -3.7e-12)
    		tmp = t_1;
    	elseif (y_46_re <= 9.5e-17)
    		tmp = Float64(Float64(1.0 / exp(t_0)) * sin(fma(log(hypot(x_46_re, x_46_im)), y_46_im, Float64(atan(x_46_im, x_46_re) * y_46_re))));
    	else
    		tmp = t_1;
    	end
    	return 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$im), $MachinePrecision]}, Block[{t$95$1 = 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] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -3.7e-12], t$95$1, If[LessEqual[y$46$re, 9.5e-17], N[(N[(1.0 / N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
    t_1 := e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_0} \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
    \mathbf{if}\;y.re \leq -3.7 \cdot 10^{-12}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y.re \leq 9.5 \cdot 10^{-17}:\\
    \;\;\;\;\frac{1}{e^{t\_0}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.re < -3.69999999999999999e-12 or 9.50000000000000029e-17 < y.re

      1. Initial program 39.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 \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      2. Taylor expanded in y.re 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 \sin \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
      3. Step-by-step derivation
        1. 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(y.re \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}}\right) \]
        2. lift-atan2.f6470.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(y.re \cdot \tan^{-1}_* \frac{x.im}{\color{blue}{x.re}}\right) \]
      4. Applied rewrites70.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 \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]

      if -3.69999999999999999e-12 < y.re < 9.50000000000000029e-17

      1. Initial program 41.7%

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

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

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

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

        Alternative 3: 61.3% accurate, N/A× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ t_1 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ t_2 := t\_1 \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{if}\;t\_2 \leq 1:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.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)))))
                (t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im))))
                (t_2 (* t_1 (sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
           (if (<= t_2 1.0) t_2 (* t_1 (sin (* y.re (atan2 x.im x.re)))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
        	double t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
        	double t_2 = t_1 * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
        	double tmp;
        	if (t_2 <= 1.0) {
        		tmp = t_2;
        	} else {
        		tmp = t_1 * sin((y_46_re * atan2(x_46_im, x_46_re)));
        	}
        	return tmp;
        }
        
        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
            real(8) :: t_1
            real(8) :: t_2
            real(8) :: tmp
            t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
            t_1 = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
            t_2 = t_1 * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
            if (t_2 <= 1.0d0) then
                tmp = t_2
            else
                tmp = t_1 * sin((y_46re * atan2(x_46im, x_46re)))
            end if
            code = tmp
        end function
        
        public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
        	double t_1 = Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
        	double t_2 = t_1 * Math.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
        	double tmp;
        	if (t_2 <= 1.0) {
        		tmp = t_2;
        	} else {
        		tmp = t_1 * Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re)));
        	}
        	return tmp;
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))
        	t_1 = math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
        	t_2 = t_1 * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
        	tmp = 0
        	if t_2 <= 1.0:
        		tmp = t_2
        	else:
        		tmp = t_1 * math.sin((y_46_re * math.atan2(x_46_im, x_46_re)))
        	return tmp
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
        	t_1 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
        	t_2 = Float64(t_1 * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))))
        	tmp = 0.0
        	if (t_2 <= 1.0)
        		tmp = t_2;
        	else
        		tmp = Float64(t_1 * sin(Float64(y_46_re * atan(x_46_im, x_46_re))));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
        	t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
        	t_2 = t_1 * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
        	tmp = 0.0;
        	if (t_2 <= 1.0)
        		tmp = t_2;
        	else
        		tmp = t_1 * sin((y_46_re * atan2(x_46_im, x_46_re)));
        	end
        	tmp_2 = tmp;
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sin[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]}, If[LessEqual[t$95$2, 1.0], t$95$2, N[(t$95$1 * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$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)\\
        t_1 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
        t_2 := t\_1 \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
        \mathbf{if}\;t\_2 \leq 1:\\
        \;\;\;\;t\_2\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1 \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.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

          1. Initial program 86.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 \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]

          if 1 < (*.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))) (sin.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 8.8%

            \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
          2. Taylor expanded in y.re 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 \sin \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
          3. Step-by-step derivation
            1. 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(y.re \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}}\right) \]
            2. lift-atan2.f6444.2

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

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

        Alternative 4: 60.5% accurate, N/A× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ t_1 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ t_2 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;t\_1 \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \leq \infty:\\ \;\;\;\;t\_1 \cdot \left(t\_2 - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot t\_2\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
                (t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im))))
                (t_2 (sin (* y.re (atan2 x.im x.re)))))
           (if (<= (* t_1 (sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re)))) INFINITY)
             (*
              t_1
              (-
               t_2
               (*
                (- y.im)
                (*
                 (sin (fma y.re (atan2 x.im x.re) (/ PI 2.0)))
                 (log (pow (fma x.im x.im (* x.re x.re)) 0.5))))))
             (* t_1 t_2))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
        	double t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
        	double t_2 = sin((y_46_re * atan2(x_46_im, x_46_re)));
        	double tmp;
        	if ((t_1 * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)))) <= ((double) INFINITY)) {
        		tmp = t_1 * (t_2 - (-y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5)))));
        	} else {
        		tmp = t_1 * t_2;
        	}
        	return tmp;
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
        	t_1 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
        	t_2 = sin(Float64(y_46_re * atan(x_46_im, x_46_re)))
        	tmp = 0.0
        	if (Float64(t_1 * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) <= Inf)
        		tmp = Float64(t_1 * Float64(t_2 - Float64(Float64(-y_46_im) * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log((fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5))))));
        	else
        		tmp = Float64(t_1 * t_2);
        	end
        	return tmp
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[Sin[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], Infinity], N[(t$95$1 * N[(t$95$2 - N[((-y$46$im) * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$2), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
        t_1 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
        t_2 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
        \mathbf{if}\;t\_1 \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \leq \infty:\\
        \;\;\;\;t\_1 \cdot \left(t\_2 - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1 \cdot t\_2\\
        
        
        \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))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0

          1. Initial program 80.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 \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
          2. Taylor expanded in y.im around 0

            \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) + y.im \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right)} \]
          3. Step-by-step derivation
            1. fp-cancel-sign-sub-invN/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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)} \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
            4. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(\color{blue}{y.im}\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
            5. lift-atan2.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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
            6. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(y.im\right)\right) \cdot \color{blue}{\left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\right) \]
            7. lower-neg.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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
            8. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}\right)\right) \]
          4. Applied rewrites78.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 \color{blue}{\left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)} \]

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

          1. Initial program 0.0%

            \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
          2. Taylor expanded in y.re 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 \sin \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
          3. Step-by-step derivation
            1. 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(y.re \cdot \color{blue}{\tan^{-1}_* \frac{x.im}{x.re}}\right) \]
            2. lift-atan2.f6442.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 \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{\color{blue}{x.re}}\right) \]
          4. Applied rewrites42.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 \sin \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 5: 46.8% accurate, N/A× speedup?

        \[\begin{array}{l} \\ e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right) \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (*
          (exp
           (-
            (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
            (* (atan2 x.im x.re) y.im)))
          (-
           (sin (* y.re (atan2 x.im x.re)))
           (*
            (- y.im)
            (*
             (sin (fma y.re (atan2 x.im x.re) (/ PI 2.0)))
             (log (pow (fma x.im x.im (* x.re x.re)) 0.5)))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	return 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))) * (sin((y_46_re * atan2(x_46_im, x_46_re))) - (-y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5)))));
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	return 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))) * Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) - Float64(Float64(-y_46_im) * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log((fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5))))))
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 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[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[((-y$46$im) * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)
        \end{array}
        
        Derivation
        1. Initial program 40.3%

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) + y.im \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right)} \]
        3. Step-by-step derivation
          1. fp-cancel-sign-sub-invN/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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)} \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          4. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(\color{blue}{y.im}\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          5. lift-atan2.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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          6. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(y.im\right)\right) \cdot \color{blue}{\left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\right) \]
          7. lower-neg.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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          8. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}\right)\right) \]
        4. Applied rewrites46.8%

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)} \]
        5. Add Preprocessing

        Alternative 6: 40.1% accurate, N/A× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \pi\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(t\_0 + y.re \cdot \mathsf{fma}\left(-0.5, y.re \cdot \left(t\_0 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right), \cos \left(0.5 \cdot \pi\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right) \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (sin (* 0.5 PI))))
           (*
            (exp
             (-
              (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
              (* (atan2 x.im x.re) y.im)))
            (-
             (sin (* y.re (atan2 x.im x.re)))
             (*
              (- y.im)
              (*
               (+
                t_0
                (*
                 y.re
                 (fma
                  -0.5
                  (* y.re (* t_0 (pow (atan2 x.im x.re) 2.0)))
                  (* (cos (* 0.5 PI)) (atan2 x.im x.re)))))
               (log (pow (fma x.im x.im (* x.re x.re)) 0.5))))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = sin((0.5 * ((double) M_PI)));
        	return 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))) * (sin((y_46_re * atan2(x_46_im, x_46_re))) - (-y_46_im * ((t_0 + (y_46_re * fma(-0.5, (y_46_re * (t_0 * pow(atan2(x_46_im, x_46_re), 2.0))), (cos((0.5 * ((double) M_PI))) * atan2(x_46_im, x_46_re))))) * log(pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5)))));
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = sin(Float64(0.5 * pi))
        	return 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))) * Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) - Float64(Float64(-y_46_im) * Float64(Float64(t_0 + Float64(y_46_re * fma(-0.5, Float64(y_46_re * Float64(t_0 * (atan(x_46_im, x_46_re) ^ 2.0))), Float64(cos(Float64(0.5 * pi)) * atan(x_46_im, x_46_re))))) * log((fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5))))))
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $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] * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[((-y$46$im) * N[(N[(t$95$0 + N[(y$46$re * N[(-0.5 * N[(y$46$re * N[(t$95$0 * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Cos[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Log[N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sin \left(0.5 \cdot \pi\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(t\_0 + y.re \cdot \mathsf{fma}\left(-0.5, y.re \cdot \left(t\_0 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right), \cos \left(0.5 \cdot \pi\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 40.3%

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

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) + y.im \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right)} \]
        3. Step-by-step derivation
          1. fp-cancel-sign-sub-invN/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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)} \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          4. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(\color{blue}{y.im}\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          5. lift-atan2.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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          6. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(\mathsf{neg}\left(y.im\right)\right) \cdot \color{blue}{\left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)}\right) \]
          7. lower-neg.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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \]
          8. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \color{blue}{\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}\right)\right) \]
        4. Applied rewrites46.8%

          \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)} \]
        5. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \color{blue}{\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)}\right)\right) \]
        6. Step-by-step derivation
          1. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\color{blue}{\frac{1}{2}}}\right)\right)\right) \]
          2. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)\right)\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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
          4. lift-PI.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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(\sin \left(\frac{1}{2} \cdot \pi\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
          5. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(\sin \left(\frac{1}{2} \cdot \pi\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
          6. 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 \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\left(\sin \left(\frac{1}{2} \cdot \pi\right) + y.re \cdot \mathsf{fma}\left(\frac{-1}{2}, y.re \cdot \left(\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right), \cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)\right)\right) \]
        7. Applied rewrites40.1%

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

        Alternative 7: 14.7% accurate, N/A× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\\ t_1 := \sin \log \left({t\_0}^{y.im}\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 \left(t\_1 - \left(-y.re\right) \cdot \mathsf{fma}\left(-0.5, y.re \cdot \left(t\_1 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right), \sin \left(\mathsf{fma}\left(y.im, \log t\_0, \frac{\pi}{2}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (pow (fma x.im x.im (* x.re x.re)) 0.5))
                (t_1 (sin (log (pow t_0 y.im)))))
           (*
            (exp
             (-
              (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
              (* (atan2 x.im x.re) y.im)))
            (-
             t_1
             (*
              (- y.re)
              (fma
               -0.5
               (* y.re (* t_1 (pow (atan2 x.im x.re) 2.0)))
               (* (sin (fma y.im (log t_0) (/ PI 2.0))) (atan2 x.im x.re))))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5);
        	double t_1 = sin(log(pow(t_0, y_46_im)));
        	return 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_1 - (-y_46_re * fma(-0.5, (y_46_re * (t_1 * pow(atan2(x_46_im, x_46_re), 2.0))), (sin(fma(y_46_im, log(t_0), (((double) M_PI) / 2.0))) * atan2(x_46_im, x_46_re)))));
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5
        	t_1 = sin(log((t_0 ^ y_46_im)))
        	return 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))) * Float64(t_1 - Float64(Float64(-y_46_re) * fma(-0.5, Float64(y_46_re * Float64(t_1 * (atan(x_46_im, x_46_re) ^ 2.0))), Float64(sin(fma(y_46_im, log(t_0), Float64(pi / 2.0))) * atan(x_46_im, x_46_re))))))
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[Log[N[Power[t$95$0, y$46$im], $MachinePrecision]], $MachinePrecision]], $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] * N[(t$95$1 - N[((-y$46$re) * N[(-0.5 * N[(y$46$re * N[(t$95$1 * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y$46$im * N[Log[t$95$0], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := {\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\\
        t_1 := \sin \log \left({t\_0}^{y.im}\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 \left(t\_1 - \left(-y.re\right) \cdot \mathsf{fma}\left(-0.5, y.re \cdot \left(t\_1 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right), \sin \left(\mathsf{fma}\left(y.im, \log t\_0, \frac{\pi}{2}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 40.3%

          \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. Taylor expanded in y.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 \color{blue}{\left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
        3. Applied rewrites14.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 \color{blue}{\left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)}^{y.im}\right) - \left(-y.re\right) \cdot \mathsf{fma}\left(-0.5, y.re \cdot \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right), \sin \left(\mathsf{fma}\left(y.im, \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right), \frac{\pi}{2}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
        4. Add Preprocessing

        Alternative 8: 10.7% accurate, N/A× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{{x.im}^{2} + {x.re}^{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 \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)}^{y.im}\right) - {y.re}^{2} \cdot \mathsf{fma}\left(-1, \frac{\sin \left(\mathsf{fma}\left(0.5, \pi, y.im \cdot \log t\_0\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.re}, 0.5 \cdot \left(\sin \log \left({t\_0}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right)\right) \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (let* ((t_0 (sqrt (+ (pow x.im 2.0) (pow x.re 2.0)))))
           (*
            (exp
             (-
              (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
              (* (atan2 x.im x.re) y.im)))
            (-
             (sin (log (pow (pow (fma x.im x.im (* x.re x.re)) 0.5) y.im)))
             (*
              (pow y.re 2.0)
              (fma
               -1.0
               (/ (* (sin (fma 0.5 PI (* y.im (log t_0)))) (atan2 x.im x.re)) y.re)
               (* 0.5 (* (sin (log (pow t_0 y.im))) (pow (atan2 x.im x.re) 2.0)))))))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double t_0 = sqrt((pow(x_46_im, 2.0) + pow(x_46_re, 2.0)));
        	return 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))) * (sin(log(pow(pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5), y_46_im))) - (pow(y_46_re, 2.0) * fma(-1.0, ((sin(fma(0.5, ((double) M_PI), (y_46_im * log(t_0)))) * atan2(x_46_im, x_46_re)) / y_46_re), (0.5 * (sin(log(pow(t_0, y_46_im))) * pow(atan2(x_46_im, x_46_re), 2.0))))));
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	t_0 = sqrt(Float64((x_46_im ^ 2.0) + (x_46_re ^ 2.0)))
        	return 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))) * Float64(sin(log(((fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5) ^ y_46_im))) - Float64((y_46_re ^ 2.0) * fma(-1.0, Float64(Float64(sin(fma(0.5, pi, Float64(y_46_im * log(t_0)))) * atan(x_46_im, x_46_re)) / y_46_re), Float64(0.5 * Float64(sin(log((t_0 ^ y_46_im))) * (atan(x_46_im, x_46_re) ^ 2.0)))))))
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Sqrt[N[(N[Power[x$46$im, 2.0], $MachinePrecision] + N[Power[x$46$re, 2.0], $MachinePrecision]), $MachinePrecision]], $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] * N[(N[Sin[N[Log[N[Power[N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision], y$46$im], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - N[(N[Power[y$46$re, 2.0], $MachinePrecision] * N[(-1.0 * N[(N[(N[Sin[N[(0.5 * Pi + N[(y$46$im * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision] + N[(0.5 * N[(N[Sin[N[Log[N[Power[t$95$0, y$46$im], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sqrt{{x.im}^{2} + {x.re}^{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 \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)}^{y.im}\right) - {y.re}^{2} \cdot \mathsf{fma}\left(-1, \frac{\sin \left(\mathsf{fma}\left(0.5, \pi, y.im \cdot \log t\_0\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.re}, 0.5 \cdot \left(\sin \log \left({t\_0}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right)\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 40.3%

          \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
        2. Taylor expanded in y.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 \color{blue}{\left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) + y.re \cdot \left(\frac{-1}{2} \cdot \left(y.re \cdot \left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right) + \cos \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
        3. Applied rewrites14.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 \color{blue}{\left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)}^{y.im}\right) - \left(-y.re\right) \cdot \mathsf{fma}\left(-0.5, y.re \cdot \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right), \sin \left(\mathsf{fma}\left(y.im, \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right), \frac{\pi}{2}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
        4. Taylor expanded in y.re 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 \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)}^{y.im}\right) - {y.re}^{2} \cdot \color{blue}{\left(-1 \cdot \frac{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.re} + \frac{1}{2} \cdot \left(\sin \log \left({\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right)}\right) \]
        5. Step-by-step derivation
          1. 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 \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)}^{y.im}\right) - {y.re}^{2} \cdot \left(-1 \cdot \frac{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.re} + \color{blue}{\frac{1}{2} \cdot \left(\sin \log \left({\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)}\right)\right) \]
          2. lower-pow.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 \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)}^{y.im}\right) - {y.re}^{2} \cdot \left(-1 \cdot \frac{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.re} + \color{blue}{\frac{1}{2}} \cdot \left(\sin \log \left({\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right)\right) \]
          3. 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 \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{\frac{1}{2}}\right)}^{y.im}\right) - {y.re}^{2} \cdot \mathsf{fma}\left(-1, \frac{\sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right) + y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}{\color{blue}{y.re}}, \frac{1}{2} \cdot \left(\sin \log \left({\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right)\right) \]
        6. Applied rewrites10.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 \left(\sin \log \left({\left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)}^{y.im}\right) - {y.re}^{2} \cdot \color{blue}{\mathsf{fma}\left(-1, \frac{\sin \left(\mathsf{fma}\left(0.5, \pi, y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}{y.re}, 0.5 \cdot \left(\sin \log \left({\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.im}\right) \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right)}\right) \]
        7. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2025101 
        (FPCore (x.re x.im y.re y.im)
          :name "powComplex, imaginary part"
          :precision binary64
          (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))