powComplex, imaginary part

Percentage Accurate: 40.9% → 66.1%
Time: 13.7s
Alternatives: 22
Speedup: 2.5×

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 22 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.9% 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: 66.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x.re \leq 3.1 \cdot 10^{-174}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_0} \cdot \sin \left(\tan^{-1}_* \frac{1}{x.re} \cdot y.re\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -4.10000000000000011e-234

    1. Initial program 40.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 \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 x.re around -inf

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

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

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

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

    if -4.10000000000000011e-234 < x.re < 3.0999999999999999e-174

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites50.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 \sin \left(\tan^{-1}_* \frac{1}{x.re} \cdot y.re\right) \]

    if 3.0999999999999999e-174 < x.re

    1. Initial program 40.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 \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 x.re around inf

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

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

Alternative 2: 64.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x.im \leq 2.2 \cdot 10^{+22}:\\
\;\;\;\;e^{\log \left(\sqrt{x.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 t\_1\\

\mathbf{else}:\\
\;\;\;\;e^{-1 \cdot \left(y.re \cdot t\_2\right) - t\_0} \cdot \sin \left(\mathsf{fma}\left(-1, y.im \cdot t\_2, t\_1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -1.6499999999999999e60

    1. Initial program 40.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 \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 x.im around -inf

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

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

    if -1.6499999999999999e60 < x.im < 2.2e22

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]

    if 2.2e22 < x.im

    1. Initial program 40.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 \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 x.im around inf

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

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

Alternative 3: 61.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_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}\\ t_2 := e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{if}\;y.re \leq -9.2 \cdot 10^{-50}:\\ \;\;\;\;t\_1 \cdot \sin \left(1 + \pi\right)\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-280}:\\ \;\;\;\;t\_2 \cdot \sin \left(\log \left(-1 \cdot x.re\right) \cdot y.im + t\_0\right)\\ \mathbf{elif}\;y.re \leq 5 \cdot 10^{-72}:\\ \;\;\;\;t\_2 \cdot \sin \left(\left(\pi \cdot \mathsf{fma}\left(0.5 \cdot \pi, x.re, \pi\right)\right) \cdot y.im + t\_0\right)\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{+175}:\\ \;\;\;\;t\_1 \cdot \left(-1 \cdot \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot 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.re))
        (t_1
         (exp
          (-
           (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
           (* (atan2 x.im x.re) y.im))))
        (t_2 (exp (- (* y.im (atan2 x.im x.re))))))
   (if (<= y.re -9.2e-50)
     (* t_1 (sin (+ 1.0 PI)))
     (if (<= y.re 1.6e-280)
       (* t_2 (sin (+ (* (log (* -1.0 x.re)) y.im) t_0)))
       (if (<= y.re 5e-72)
         (* t_2 (sin (+ (* (* PI (fma (* 0.5 PI) x.re PI)) y.im) t_0)))
         (if (<= y.re 2e+175)
           (* t_1 (* -1.0 (* y.re (atan2 1.0 x.re))))
           (* t_1 1.0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = atan2(x_46_im, x_46_re) * y_46_re;
	double t_1 = 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)));
	double t_2 = exp(-(y_46_im * atan2(x_46_im, x_46_re)));
	double tmp;
	if (y_46_re <= -9.2e-50) {
		tmp = t_1 * sin((1.0 + ((double) M_PI)));
	} else if (y_46_re <= 1.6e-280) {
		tmp = t_2 * sin(((log((-1.0 * x_46_re)) * y_46_im) + t_0));
	} else if (y_46_re <= 5e-72) {
		tmp = t_2 * sin((((((double) M_PI) * fma((0.5 * ((double) M_PI)), x_46_re, ((double) M_PI))) * y_46_im) + t_0));
	} else if (y_46_re <= 2e+175) {
		tmp = t_1 * (-1.0 * (y_46_re * atan2(1.0, x_46_re)));
	} else {
		tmp = t_1 * 1.0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(atan(x_46_im, x_46_re) * y_46_re)
	t_1 = 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_2 = exp(Float64(-Float64(y_46_im * atan(x_46_im, x_46_re))))
	tmp = 0.0
	if (y_46_re <= -9.2e-50)
		tmp = Float64(t_1 * sin(Float64(1.0 + pi)));
	elseif (y_46_re <= 1.6e-280)
		tmp = Float64(t_2 * sin(Float64(Float64(log(Float64(-1.0 * x_46_re)) * y_46_im) + t_0)));
	elseif (y_46_re <= 5e-72)
		tmp = Float64(t_2 * sin(Float64(Float64(Float64(pi * fma(Float64(0.5 * pi), x_46_re, pi)) * y_46_im) + t_0)));
	elseif (y_46_re <= 2e+175)
		tmp = Float64(t_1 * Float64(-1.0 * Float64(y_46_re * atan(1.0, x_46_re))));
	else
		tmp = Float64(t_1 * 1.0);
	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$re), $MachinePrecision]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[Exp[(-N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]}, If[LessEqual[y$46$re, -9.2e-50], N[(t$95$1 * N[Sin[N[(1.0 + Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.6e-280], N[(t$95$2 * N[Sin[N[(N[(N[Log[N[(-1.0 * x$46$re), $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 5e-72], N[(t$95$2 * N[Sin[N[(N[(N[(Pi * N[(N[(0.5 * Pi), $MachinePrecision] * x$46$re + Pi), $MachinePrecision]), $MachinePrecision] * y$46$im), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2e+175], N[(t$95$1 * N[(-1.0 * N[(y$46$re * N[ArcTan[1.0 / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * 1.0), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
t_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}\\
t_2 := e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;y.re \leq -9.2 \cdot 10^{-50}:\\
\;\;\;\;t\_1 \cdot \sin \left(1 + \pi\right)\\

\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-280}:\\
\;\;\;\;t\_2 \cdot \sin \left(\log \left(-1 \cdot x.re\right) \cdot y.im + t\_0\right)\\

\mathbf{elif}\;y.re \leq 5 \cdot 10^{-72}:\\
\;\;\;\;t\_2 \cdot \sin \left(\left(\pi \cdot \mathsf{fma}\left(0.5 \cdot \pi, x.re, \pi\right)\right) \cdot y.im + t\_0\right)\\

\mathbf{elif}\;y.re \leq 2 \cdot 10^{+175}:\\
\;\;\;\;t\_1 \cdot \left(-1 \cdot \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -9.20000000000000078e-50

    1. Initial program 40.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 \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(\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 rewrites39.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}{\left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) + y.re \cdot \left(\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)} \]
    4. 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 \left(\sin \left(1 + \pi\right) + \color{blue}{y.re} \cdot \left(\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) \]
    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 \sin \left(1 + \mathsf{PI}\left(\right)\right) \]
    6. Applied rewrites48.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 \sin \left(1 + \pi\right) \]

    if -9.20000000000000078e-50 < y.re < 1.6e-280

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \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) \]
    4. Taylor expanded in x.re around -inf

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

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

    if 1.6e-280 < y.re < 4.9999999999999996e-72

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \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) \]
    4. Taylor expanded in x.im around -inf

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

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

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

    if 4.9999999999999996e-72 < y.re < 1.9999999999999999e175

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\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(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]
    6. Applied rewrites49.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 \left(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]

    if 1.9999999999999999e175 < y.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 1 \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 4: 59.2% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \log \left(-1 \cdot x.im\right)\\
\mathbf{if}\;x.im \leq -1.65 \cdot 10^{+60}:\\
\;\;\;\;e^{t\_2 \cdot y.re - t\_0} \cdot \sin \left(t\_2 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\

\mathbf{elif}\;x.im \leq 7.8 \cdot 10^{+78}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_0} \cdot \sin t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.im < -1.6499999999999999e60

    1. Initial program 40.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 \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 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 \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) \]
    3. Applied rewrites17.7%

      \[\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 \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) \]
    4. Taylor expanded in x.im around -inf

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

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

    if -1.6499999999999999e60 < x.im < 7.8000000000000008e78

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]

    if 7.8000000000000008e78 < x.im

    1. Initial program 40.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 \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 x.im around inf

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

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

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

Alternative 5: 58.2% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re\\ t_1 := e^{t\_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{if}\;y.re \leq -1.25 \cdot 10^{-19}:\\ \;\;\;\;e^{t\_0 - \left(-\tan^{-1}_* \frac{\pi}{x.re}\right) \cdot y.im} \cdot -1\\ \mathbf{elif}\;y.re \leq 5 \cdot 10^{-72}:\\ \;\;\;\;e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + 2}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{+175}:\\ \;\;\;\;t\_1 \cdot \left(-1 \cdot \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot 1\\ \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)))) y.re))
        (t_1 (exp (- t_0 (* (atan2 x.im x.re) y.im)))))
   (if (<= y.re -1.25e-19)
     (* (exp (- t_0 (* (- (atan2 PI x.re)) y.im))) -1.0)
     (if (<= y.re 5e-72)
       (*
        (exp (- (* y.im (atan2 x.im x.re))))
        (sin
         (+
          (* (log (sqrt (+ (* x.re x.re) 2.0))) y.im)
          (* (atan2 x.im x.re) y.re))))
       (if (<= y.re 2e+175)
         (* t_1 (* -1.0 (* y.re (atan2 1.0 x.re))))
         (* t_1 1.0))))))
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)))) * y_46_re;
	double t_1 = exp((t_0 - (atan2(x_46_im, x_46_re) * y_46_im)));
	double tmp;
	if (y_46_re <= -1.25e-19) {
		tmp = exp((t_0 - (-atan2(((double) M_PI), x_46_re) * y_46_im))) * -1.0;
	} else if (y_46_re <= 5e-72) {
		tmp = exp(-(y_46_im * atan2(x_46_im, x_46_re))) * sin(((log(sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	} else if (y_46_re <= 2e+175) {
		tmp = t_1 * (-1.0 * (y_46_re * atan2(1.0, x_46_re)));
	} else {
		tmp = t_1 * 1.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.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re;
	double t_1 = Math.exp((t_0 - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
	double tmp;
	if (y_46_re <= -1.25e-19) {
		tmp = Math.exp((t_0 - (-Math.atan2(Math.PI, x_46_re) * y_46_im))) * -1.0;
	} else if (y_46_re <= 5e-72) {
		tmp = Math.exp(-(y_46_im * Math.atan2(x_46_im, x_46_re))) * Math.sin(((Math.log(Math.sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
	} else if (y_46_re <= 2e+175) {
		tmp = t_1 * (-1.0 * (y_46_re * Math.atan2(1.0, x_46_re)));
	} else {
		tmp = t_1 * 1.0;
	}
	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)))) * y_46_re
	t_1 = math.exp((t_0 - (math.atan2(x_46_im, x_46_re) * y_46_im)))
	tmp = 0
	if y_46_re <= -1.25e-19:
		tmp = math.exp((t_0 - (-math.atan2(math.pi, x_46_re) * y_46_im))) * -1.0
	elif y_46_re <= 5e-72:
		tmp = math.exp(-(y_46_im * math.atan2(x_46_im, x_46_re))) * math.sin(((math.log(math.sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
	elif y_46_re <= 2e+175:
		tmp = t_1 * (-1.0 * (y_46_re * math.atan2(1.0, x_46_re)))
	else:
		tmp = t_1 * 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re)
	t_1 = exp(Float64(t_0 - Float64(atan(x_46_im, x_46_re) * y_46_im)))
	tmp = 0.0
	if (y_46_re <= -1.25e-19)
		tmp = Float64(exp(Float64(t_0 - Float64(Float64(-atan(pi, x_46_re)) * y_46_im))) * -1.0);
	elseif (y_46_re <= 5e-72)
		tmp = Float64(exp(Float64(-Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + 2.0))) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))));
	elseif (y_46_re <= 2e+175)
		tmp = Float64(t_1 * Float64(-1.0 * Float64(y_46_re * atan(1.0, x_46_re))));
	else
		tmp = Float64(t_1 * 1.0);
	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)))) * y_46_re;
	t_1 = exp((t_0 - (atan2(x_46_im, x_46_re) * y_46_im)));
	tmp = 0.0;
	if (y_46_re <= -1.25e-19)
		tmp = exp((t_0 - (-atan2(pi, x_46_re) * y_46_im))) * -1.0;
	elseif (y_46_re <= 5e-72)
		tmp = exp(-(y_46_im * atan2(x_46_im, x_46_re))) * sin(((log(sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	elseif (y_46_re <= 2e+175)
		tmp = t_1 * (-1.0 * (y_46_re * atan2(1.0, x_46_re)));
	else
		tmp = t_1 * 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[Exp[N[(t$95$0 - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1.25e-19], N[(N[Exp[N[(t$95$0 - N[((-N[ArcTan[Pi / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision], If[LessEqual[y$46$re, 5e-72], N[(N[Exp[(-N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision])], $MachinePrecision] * N[Sin[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2e+175], N[(t$95$1 * N[(-1.0 * N[(y$46$re * N[ArcTan[1.0 / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * 1.0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re\\
t_1 := e^{t\_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq -1.25 \cdot 10^{-19}:\\
\;\;\;\;e^{t\_0 - \left(-\tan^{-1}_* \frac{\pi}{x.re}\right) \cdot y.im} \cdot -1\\

\mathbf{elif}\;y.re \leq 5 \cdot 10^{-72}:\\
\;\;\;\;e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + 2}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\

\mathbf{elif}\;y.re \leq 2 \cdot 10^{+175}:\\
\;\;\;\;t\_1 \cdot \left(-1 \cdot \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -1.2500000000000001e-19

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites42.1%

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

    if -1.2500000000000001e-19 < y.re < 4.9999999999999996e-72

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

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

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

    if 4.9999999999999996e-72 < y.re < 1.9999999999999999e175

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\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(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]
    6. Applied rewrites49.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 \left(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]

    if 1.9999999999999999e175 < y.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 1 \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 6: 58.2% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
t_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}\\
t_1 := e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;y.re \leq -9.2 \cdot 10^{-50}:\\
\;\;\;\;t\_0 \cdot \sin \left(1 + \pi\right)\\

\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{-281}:\\
\;\;\;\;t\_1 \cdot \sin \left(\log \left(-1 \cdot x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\

\mathbf{elif}\;y.re \leq 8.8 \cdot 10^{-246}:\\
\;\;\;\;t\_1 \cdot \sin \left(1 \cdot \mathsf{fma}\left(\tan^{-1}_* \frac{1}{x.re}, y.re, 1\right)\right)\\

\mathbf{elif}\;y.re \leq 2 \cdot 10^{+175}:\\
\;\;\;\;t\_0 \cdot \left(-1 \cdot \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -9.20000000000000078e-50

    1. Initial program 40.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 \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(\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 rewrites39.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}{\left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) + y.re \cdot \left(\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)} \]
    4. 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 \left(\sin \left(1 + \pi\right) + \color{blue}{y.re} \cdot \left(\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) \]
    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 \sin \left(1 + \mathsf{PI}\left(\right)\right) \]
    6. Applied rewrites48.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 \sin \left(1 + \pi\right) \]

    if -9.20000000000000078e-50 < y.re < 3.9000000000000002e-281

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \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) \]
    4. Taylor expanded in x.re around -inf

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

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

    if 3.9000000000000002e-281 < y.re < 8.79999999999999992e-246

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \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) \]
    4. Applied rewrites30.3%

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

    if 8.79999999999999992e-246 < y.re < 1.9999999999999999e175

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\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(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]
    6. Applied rewrites49.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 \left(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]

    if 1.9999999999999999e175 < y.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 1 \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 7: 56.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re\\ \mathbf{if}\;y.re \leq -1.25 \cdot 10^{-19}:\\ \;\;\;\;e^{t\_0 - \left(-\tan^{-1}_* \frac{\pi}{x.re}\right) \cdot y.im} \cdot -1\\ \mathbf{elif}\;y.re \leq 5 \cdot 10^{-72}:\\ \;\;\;\;e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + 2}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{else}:\\ \;\;\;\;e^{t\_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\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)))) y.re)))
   (if (<= y.re -1.25e-19)
     (* (exp (- t_0 (* (- (atan2 PI x.re)) y.im))) -1.0)
     (if (<= y.re 5e-72)
       (*
        (exp (- (* y.im (atan2 x.im x.re))))
        (sin
         (+
          (* (log (sqrt (+ (* x.re x.re) 2.0))) y.im)
          (* (atan2 x.im x.re) y.re))))
       (*
        (exp (- t_0 (* (atan2 x.im x.re) y.im)))
        (- (sin (* y.re (atan2 1.0 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)))) * y_46_re;
	double tmp;
	if (y_46_re <= -1.25e-19) {
		tmp = exp((t_0 - (-atan2(((double) M_PI), x_46_re) * y_46_im))) * -1.0;
	} else if (y_46_re <= 5e-72) {
		tmp = exp(-(y_46_im * atan2(x_46_im, x_46_re))) * sin(((log(sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	} else {
		tmp = exp((t_0 - (atan2(x_46_im, x_46_re) * y_46_im))) * -sin((y_46_re * atan2(1.0, x_46_re)));
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re;
	double tmp;
	if (y_46_re <= -1.25e-19) {
		tmp = Math.exp((t_0 - (-Math.atan2(Math.PI, x_46_re) * y_46_im))) * -1.0;
	} else if (y_46_re <= 5e-72) {
		tmp = Math.exp(-(y_46_im * Math.atan2(x_46_im, x_46_re))) * Math.sin(((Math.log(Math.sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
	} else {
		tmp = Math.exp((t_0 - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * -Math.sin((y_46_re * Math.atan2(1.0, 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)))) * y_46_re
	tmp = 0
	if y_46_re <= -1.25e-19:
		tmp = math.exp((t_0 - (-math.atan2(math.pi, x_46_re) * y_46_im))) * -1.0
	elif y_46_re <= 5e-72:
		tmp = math.exp(-(y_46_im * math.atan2(x_46_im, x_46_re))) * math.sin(((math.log(math.sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
	else:
		tmp = math.exp((t_0 - (math.atan2(x_46_im, x_46_re) * y_46_im))) * -math.sin((y_46_re * math.atan2(1.0, x_46_re)))
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re)
	tmp = 0.0
	if (y_46_re <= -1.25e-19)
		tmp = Float64(exp(Float64(t_0 - Float64(Float64(-atan(pi, x_46_re)) * y_46_im))) * -1.0);
	elseif (y_46_re <= 5e-72)
		tmp = Float64(exp(Float64(-Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + 2.0))) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))));
	else
		tmp = Float64(exp(Float64(t_0 - Float64(atan(x_46_im, x_46_re) * y_46_im))) * Float64(-sin(Float64(y_46_re * atan(1.0, 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)))) * y_46_re;
	tmp = 0.0;
	if (y_46_re <= -1.25e-19)
		tmp = exp((t_0 - (-atan2(pi, x_46_re) * y_46_im))) * -1.0;
	elseif (y_46_re <= 5e-72)
		tmp = exp(-(y_46_im * atan2(x_46_im, x_46_re))) * sin(((log(sqrt(((x_46_re * x_46_re) + 2.0))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	else
		tmp = exp((t_0 - (atan2(x_46_im, x_46_re) * y_46_im))) * -sin((y_46_re * atan2(1.0, 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[(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]}, If[LessEqual[y$46$re, -1.25e-19], N[(N[Exp[N[(t$95$0 - N[((-N[ArcTan[Pi / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision], If[LessEqual[y$46$re, 5e-72], N[(N[Exp[(-N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision])], $MachinePrecision] * N[Sin[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(t$95$0 - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(y$46$re * N[ArcTan[1.0 / 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) \cdot y.re\\
\mathbf{if}\;y.re \leq -1.25 \cdot 10^{-19}:\\
\;\;\;\;e^{t\_0 - \left(-\tan^{-1}_* \frac{\pi}{x.re}\right) \cdot y.im} \cdot -1\\

\mathbf{elif}\;y.re \leq 5 \cdot 10^{-72}:\\
\;\;\;\;e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + 2}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\

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


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

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites42.1%

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

    if -1.2500000000000001e-19 < y.re < 4.9999999999999996e-72

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

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

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

    if 4.9999999999999996e-72 < y.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 56.4% accurate, 0.2× 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 := \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ t_2 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ t_3 := t\_2 \cdot t\_1\\ t_4 := 1 \cdot t\_1\\ \mathbf{if}\;t\_3 \leq -4 \cdot 10^{+117}:\\ \;\;\;\;t\_2 \cdot -1\\ \mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-190}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;t\_3 \leq 10^{-206}:\\ \;\;\;\;t\_2 \cdot 1\\ \mathbf{elif}\;t\_3 \leq 0.5:\\ \;\;\;\;t\_4\\ \mathbf{else}:\\ \;\;\;\;t\_2 \cdot \sin \left(1 + \pi\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 (sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))
        (t_2 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im))))
        (t_3 (* t_2 t_1))
        (t_4 (* 1.0 t_1)))
   (if (<= t_3 -4e+117)
     (* t_2 -1.0)
     (if (<= t_3 -2e-190)
       t_4
       (if (<= t_3 1e-206)
         (* t_2 1.0)
         (if (<= t_3 0.5) t_4 (* t_2 (sin (+ 1.0 PI)))))))))
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 = sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	double t_2 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	double t_3 = t_2 * t_1;
	double t_4 = 1.0 * t_1;
	double tmp;
	if (t_3 <= -4e+117) {
		tmp = t_2 * -1.0;
	} else if (t_3 <= -2e-190) {
		tmp = t_4;
	} else if (t_3 <= 1e-206) {
		tmp = t_2 * 1.0;
	} else if (t_3 <= 0.5) {
		tmp = t_4;
	} else {
		tmp = t_2 * sin((1.0 + ((double) M_PI)));
	}
	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.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	double t_1 = Math.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
	double t_2 = Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
	double t_3 = t_2 * t_1;
	double t_4 = 1.0 * t_1;
	double tmp;
	if (t_3 <= -4e+117) {
		tmp = t_2 * -1.0;
	} else if (t_3 <= -2e-190) {
		tmp = t_4;
	} else if (t_3 <= 1e-206) {
		tmp = t_2 * 1.0;
	} else if (t_3 <= 0.5) {
		tmp = t_4;
	} else {
		tmp = t_2 * Math.sin((1.0 + Math.PI));
	}
	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.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
	t_2 = math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
	t_3 = t_2 * t_1
	t_4 = 1.0 * t_1
	tmp = 0
	if t_3 <= -4e+117:
		tmp = t_2 * -1.0
	elif t_3 <= -2e-190:
		tmp = t_4
	elif t_3 <= 1e-206:
		tmp = t_2 * 1.0
	elif t_3 <= 0.5:
		tmp = t_4
	else:
		tmp = t_2 * math.sin((1.0 + math.pi))
	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 = sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))
	t_2 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
	t_3 = Float64(t_2 * t_1)
	t_4 = Float64(1.0 * t_1)
	tmp = 0.0
	if (t_3 <= -4e+117)
		tmp = Float64(t_2 * -1.0);
	elseif (t_3 <= -2e-190)
		tmp = t_4;
	elseif (t_3 <= 1e-206)
		tmp = Float64(t_2 * 1.0);
	elseif (t_3 <= 0.5)
		tmp = t_4;
	else
		tmp = Float64(t_2 * sin(Float64(1.0 + pi)));
	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 = sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	t_2 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	t_3 = t_2 * t_1;
	t_4 = 1.0 * t_1;
	tmp = 0.0;
	if (t_3 <= -4e+117)
		tmp = t_2 * -1.0;
	elseif (t_3 <= -2e-190)
		tmp = t_4;
	elseif (t_3 <= 1e-206)
		tmp = t_2 * 1.0;
	elseif (t_3 <= 0.5)
		tmp = t_4;
	else
		tmp = t_2 * sin((1.0 + pi));
	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[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]}, Block[{t$95$2 = 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$3 = N[(t$95$2 * t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, -4e+117], N[(t$95$2 * -1.0), $MachinePrecision], If[LessEqual[t$95$3, -2e-190], t$95$4, If[LessEqual[t$95$3, 1e-206], N[(t$95$2 * 1.0), $MachinePrecision], If[LessEqual[t$95$3, 0.5], t$95$4, N[(t$95$2 * N[Sin[N[(1.0 + Pi), $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 := \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
t_2 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_3 := t\_2 \cdot t\_1\\
t_4 := 1 \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{+117}:\\
\;\;\;\;t\_2 \cdot -1\\

\mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-190}:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;t\_3 \leq 10^{-206}:\\
\;\;\;\;t\_2 \cdot 1\\

\mathbf{elif}\;t\_3 \leq 0.5:\\
\;\;\;\;t\_4\\

\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \sin \left(1 + \pi\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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)))) < -4.0000000000000002e117

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]

    if -4.0000000000000002e117 < (*.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)))) < -2e-190 or 1.00000000000000003e-206 < (*.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)))) < 0.5

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \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) \]
    4. Taylor expanded in y.im around 0

      \[\leadsto 1 \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) \]
    5. Applied rewrites13.7%

      \[\leadsto 1 \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 -2e-190 < (*.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.00000000000000003e-206

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 1 \]

    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))) (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 40.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 \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(\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 rewrites39.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}{\left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) + y.re \cdot \left(\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)} \]
    4. 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 \left(\sin \left(1 + \pi\right) + \color{blue}{y.re} \cdot \left(\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) \]
    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 \sin \left(1 + \mathsf{PI}\left(\right)\right) \]
    6. Applied rewrites48.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 \sin \left(1 + \pi\right) \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 9: 55.4% accurate, 0.2× 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 := \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ t_2 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ t_3 := t\_2 \cdot t\_1\\ t_4 := 1 \cdot t\_1\\ t_5 := t\_2 \cdot -1\\ \mathbf{if}\;t\_3 \leq -4 \cdot 10^{+117}:\\ \;\;\;\;t\_5\\ \mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-190}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;t\_3 \leq 10^{-206}:\\ \;\;\;\;t\_2 \cdot 1\\ \mathbf{elif}\;t\_3 \leq 0.5:\\ \;\;\;\;t\_4\\ \mathbf{else}:\\ \;\;\;\;t\_5\\ \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 (sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))
        (t_2 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im))))
        (t_3 (* t_2 t_1))
        (t_4 (* 1.0 t_1))
        (t_5 (* t_2 -1.0)))
   (if (<= t_3 -4e+117)
     t_5
     (if (<= t_3 -2e-190)
       t_4
       (if (<= t_3 1e-206) (* t_2 1.0) (if (<= t_3 0.5) t_4 t_5))))))
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 = sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	double t_2 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	double t_3 = t_2 * t_1;
	double t_4 = 1.0 * t_1;
	double t_5 = t_2 * -1.0;
	double tmp;
	if (t_3 <= -4e+117) {
		tmp = t_5;
	} else if (t_3 <= -2e-190) {
		tmp = t_4;
	} else if (t_3 <= 1e-206) {
		tmp = t_2 * 1.0;
	} else if (t_3 <= 0.5) {
		tmp = t_4;
	} else {
		tmp = t_5;
	}
	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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
    t_1 = sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
    t_2 = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
    t_3 = t_2 * t_1
    t_4 = 1.0d0 * t_1
    t_5 = t_2 * (-1.0d0)
    if (t_3 <= (-4d+117)) then
        tmp = t_5
    else if (t_3 <= (-2d-190)) then
        tmp = t_4
    else if (t_3 <= 1d-206) then
        tmp = t_2 * 1.0d0
    else if (t_3 <= 0.5d0) then
        tmp = t_4
    else
        tmp = t_5
    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.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
	double t_2 = Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
	double t_3 = t_2 * t_1;
	double t_4 = 1.0 * t_1;
	double t_5 = t_2 * -1.0;
	double tmp;
	if (t_3 <= -4e+117) {
		tmp = t_5;
	} else if (t_3 <= -2e-190) {
		tmp = t_4;
	} else if (t_3 <= 1e-206) {
		tmp = t_2 * 1.0;
	} else if (t_3 <= 0.5) {
		tmp = t_4;
	} else {
		tmp = t_5;
	}
	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.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
	t_2 = math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
	t_3 = t_2 * t_1
	t_4 = 1.0 * t_1
	t_5 = t_2 * -1.0
	tmp = 0
	if t_3 <= -4e+117:
		tmp = t_5
	elif t_3 <= -2e-190:
		tmp = t_4
	elif t_3 <= 1e-206:
		tmp = t_2 * 1.0
	elif t_3 <= 0.5:
		tmp = t_4
	else:
		tmp = t_5
	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 = sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))
	t_2 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
	t_3 = Float64(t_2 * t_1)
	t_4 = Float64(1.0 * t_1)
	t_5 = Float64(t_2 * -1.0)
	tmp = 0.0
	if (t_3 <= -4e+117)
		tmp = t_5;
	elseif (t_3 <= -2e-190)
		tmp = t_4;
	elseif (t_3 <= 1e-206)
		tmp = Float64(t_2 * 1.0);
	elseif (t_3 <= 0.5)
		tmp = t_4;
	else
		tmp = t_5;
	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 = sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	t_2 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	t_3 = t_2 * t_1;
	t_4 = 1.0 * t_1;
	t_5 = t_2 * -1.0;
	tmp = 0.0;
	if (t_3 <= -4e+117)
		tmp = t_5;
	elseif (t_3 <= -2e-190)
		tmp = t_4;
	elseif (t_3 <= 1e-206)
		tmp = t_2 * 1.0;
	elseif (t_3 <= 0.5)
		tmp = t_4;
	else
		tmp = t_5;
	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[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]}, Block[{t$95$2 = 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$3 = N[(t$95$2 * t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 * t$95$1), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 * -1.0), $MachinePrecision]}, If[LessEqual[t$95$3, -4e+117], t$95$5, If[LessEqual[t$95$3, -2e-190], t$95$4, If[LessEqual[t$95$3, 1e-206], N[(t$95$2 * 1.0), $MachinePrecision], If[LessEqual[t$95$3, 0.5], t$95$4, t$95$5]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_1 := \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
t_2 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_3 := t\_2 \cdot t\_1\\
t_4 := 1 \cdot t\_1\\
t_5 := t\_2 \cdot -1\\
\mathbf{if}\;t\_3 \leq -4 \cdot 10^{+117}:\\
\;\;\;\;t\_5\\

\mathbf{elif}\;t\_3 \leq -2 \cdot 10^{-190}:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;t\_3 \leq 10^{-206}:\\
\;\;\;\;t\_2 \cdot 1\\

\mathbf{elif}\;t\_3 \leq 0.5:\\
\;\;\;\;t\_4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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)))) < -4.0000000000000002e117 or 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))) (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 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]

    if -4.0000000000000002e117 < (*.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)))) < -2e-190 or 1.00000000000000003e-206 < (*.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)))) < 0.5

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \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) \]
    4. Taylor expanded in y.im around 0

      \[\leadsto 1 \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) \]
    5. Applied rewrites13.7%

      \[\leadsto 1 \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 -2e-190 < (*.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.00000000000000003e-206

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 1 \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 10: 53.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ t_1 := \log \left(-1 \cdot x.re\right)\\ \mathbf{if}\;x.re \leq -2 \cdot 10^{+21}:\\ \;\;\;\;e^{t\_1 \cdot y.re - t\_0} \cdot \sin \left(t\_1 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{else}:\\ \;\;\;\;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)\\ \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 (log (* -1.0 x.re))))
   (if (<= x.re -2e+21)
     (*
      (exp (- (* t_1 y.re) t_0))
      (sin (+ (* t_1 y.im) (* (atan2 x.im x.re) y.re))))
     (*
      (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_0))
      (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 = atan2(x_46_im, x_46_re) * y_46_im;
	double t_1 = log((-1.0 * x_46_re));
	double tmp;
	if (x_46_re <= -2e+21) {
		tmp = exp(((t_1 * y_46_re) - t_0)) * sin(((t_1 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	} else {
		tmp = 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)));
	}
	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) :: tmp
    t_0 = atan2(x_46im, x_46re) * y_46im
    t_1 = log(((-1.0d0) * x_46re))
    if (x_46re <= (-2d+21)) then
        tmp = exp(((t_1 * y_46re) - t_0)) * sin(((t_1 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
    else
        tmp = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - t_0)) * 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.atan2(x_46_im, x_46_re) * y_46_im;
	double t_1 = Math.log((-1.0 * x_46_re));
	double tmp;
	if (x_46_re <= -2e+21) {
		tmp = Math.exp(((t_1 * y_46_re) - t_0)) * Math.sin(((t_1 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
	} else {
		tmp = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * 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.atan2(x_46_im, x_46_re) * y_46_im
	t_1 = math.log((-1.0 * x_46_re))
	tmp = 0
	if x_46_re <= -2e+21:
		tmp = math.exp(((t_1 * y_46_re) - t_0)) * math.sin(((t_1 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
	else:
		tmp = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * 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 = Float64(atan(x_46_im, x_46_re) * y_46_im)
	t_1 = log(Float64(-1.0 * x_46_re))
	tmp = 0.0
	if (x_46_re <= -2e+21)
		tmp = Float64(exp(Float64(Float64(t_1 * y_46_re) - t_0)) * sin(Float64(Float64(t_1 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))));
	else
		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) - t_0)) * 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 = atan2(x_46_im, x_46_re) * y_46_im;
	t_1 = log((-1.0 * x_46_re));
	tmp = 0.0;
	if (x_46_re <= -2e+21)
		tmp = exp(((t_1 * y_46_re) - t_0)) * sin(((t_1 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
	else
		tmp = 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)));
	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$im), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[(-1.0 * x$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -2e+21], N[(N[Exp[N[(N[(t$95$1 * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$1 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $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] - t$95$0), $MachinePrecision]], $MachinePrecision] * 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 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \log \left(-1 \cdot x.re\right)\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{+21}:\\
\;\;\;\;e^{t\_1 \cdot y.re - t\_0} \cdot \sin \left(t\_1 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\

\mathbf{else}:\\
\;\;\;\;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)\\


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

    1. Initial program 40.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 \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 x.re around -inf

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

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

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

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

    if -2e21 < x.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 52.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_1 := 1 \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + \left|x.im\right|}\right) \cdot y.im + t\_0\right)\\ t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ t_3 := e^{t\_2 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ t_4 := t\_3 \cdot \sin \left(t\_2 \cdot y.im + t\_0\right)\\ t_5 := t\_3 \cdot -1\\ \mathbf{if}\;t\_4 \leq -0.2:\\ \;\;\;\;t\_5\\ \mathbf{elif}\;t\_4 \leq -2 \cdot 10^{-190}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_4 \leq 10^{-206}:\\ \;\;\;\;t\_3 \cdot 1\\ \mathbf{elif}\;t\_4 \leq 0.5:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_5\\ \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
         (*
          1.0
          (sin (+ (* (log (sqrt (+ (* x.re x.re) (fabs x.im)))) y.im) t_0))))
        (t_2 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
        (t_3 (exp (- (* t_2 y.re) (* (atan2 x.im x.re) y.im))))
        (t_4 (* t_3 (sin (+ (* t_2 y.im) t_0))))
        (t_5 (* t_3 -1.0)))
   (if (<= t_4 -0.2)
     t_5
     (if (<= t_4 -2e-190)
       t_1
       (if (<= t_4 1e-206) (* t_3 1.0) (if (<= t_4 0.5) t_1 t_5))))))
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 = 1.0 * sin(((log(sqrt(((x_46_re * x_46_re) + fabs(x_46_im)))) * y_46_im) + t_0));
	double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	double t_3 = exp(((t_2 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	double t_4 = t_3 * sin(((t_2 * y_46_im) + t_0));
	double t_5 = t_3 * -1.0;
	double tmp;
	if (t_4 <= -0.2) {
		tmp = t_5;
	} else if (t_4 <= -2e-190) {
		tmp = t_1;
	} else if (t_4 <= 1e-206) {
		tmp = t_3 * 1.0;
	} else if (t_4 <= 0.5) {
		tmp = t_1;
	} else {
		tmp = t_5;
	}
	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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = atan2(x_46im, x_46re) * y_46re
    t_1 = 1.0d0 * sin(((log(sqrt(((x_46re * x_46re) + abs(x_46im)))) * y_46im) + t_0))
    t_2 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
    t_3 = exp(((t_2 * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
    t_4 = t_3 * sin(((t_2 * y_46im) + t_0))
    t_5 = t_3 * (-1.0d0)
    if (t_4 <= (-0.2d0)) then
        tmp = t_5
    else if (t_4 <= (-2d-190)) then
        tmp = t_1
    else if (t_4 <= 1d-206) then
        tmp = t_3 * 1.0d0
    else if (t_4 <= 0.5d0) then
        tmp = t_1
    else
        tmp = t_5
    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.atan2(x_46_im, x_46_re) * y_46_re;
	double t_1 = 1.0 * Math.sin(((Math.log(Math.sqrt(((x_46_re * x_46_re) + Math.abs(x_46_im)))) * y_46_im) + t_0));
	double t_2 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	double t_3 = Math.exp(((t_2 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
	double t_4 = t_3 * Math.sin(((t_2 * y_46_im) + t_0));
	double t_5 = t_3 * -1.0;
	double tmp;
	if (t_4 <= -0.2) {
		tmp = t_5;
	} else if (t_4 <= -2e-190) {
		tmp = t_1;
	} else if (t_4 <= 1e-206) {
		tmp = t_3 * 1.0;
	} else if (t_4 <= 0.5) {
		tmp = t_1;
	} else {
		tmp = t_5;
	}
	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 = 1.0 * math.sin(((math.log(math.sqrt(((x_46_re * x_46_re) + math.fabs(x_46_im)))) * y_46_im) + t_0))
	t_2 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))
	t_3 = math.exp(((t_2 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
	t_4 = t_3 * math.sin(((t_2 * y_46_im) + t_0))
	t_5 = t_3 * -1.0
	tmp = 0
	if t_4 <= -0.2:
		tmp = t_5
	elif t_4 <= -2e-190:
		tmp = t_1
	elif t_4 <= 1e-206:
		tmp = t_3 * 1.0
	elif t_4 <= 0.5:
		tmp = t_1
	else:
		tmp = t_5
	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 = Float64(1.0 * sin(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + abs(x_46_im)))) * y_46_im) + t_0)))
	t_2 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))
	t_3 = exp(Float64(Float64(t_2 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
	t_4 = Float64(t_3 * sin(Float64(Float64(t_2 * y_46_im) + t_0)))
	t_5 = Float64(t_3 * -1.0)
	tmp = 0.0
	if (t_4 <= -0.2)
		tmp = t_5;
	elseif (t_4 <= -2e-190)
		tmp = t_1;
	elseif (t_4 <= 1e-206)
		tmp = Float64(t_3 * 1.0);
	elseif (t_4 <= 0.5)
		tmp = t_1;
	else
		tmp = t_5;
	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 = 1.0 * sin(((log(sqrt(((x_46_re * x_46_re) + abs(x_46_im)))) * y_46_im) + t_0));
	t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	t_3 = exp(((t_2 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
	t_4 = t_3 * sin(((t_2 * y_46_im) + t_0));
	t_5 = t_3 * -1.0;
	tmp = 0.0;
	if (t_4 <= -0.2)
		tmp = t_5;
	elseif (t_4 <= -2e-190)
		tmp = t_1;
	elseif (t_4 <= 1e-206)
		tmp = t_3 * 1.0;
	elseif (t_4 <= 0.5)
		tmp = t_1;
	else
		tmp = t_5;
	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[(1.0 * N[Sin[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[Abs[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(t$95$2 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * N[Sin[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 * -1.0), $MachinePrecision]}, If[LessEqual[t$95$4, -0.2], t$95$5, If[LessEqual[t$95$4, -2e-190], t$95$1, If[LessEqual[t$95$4, 1e-206], N[(t$95$3 * 1.0), $MachinePrecision], If[LessEqual[t$95$4, 0.5], t$95$1, t$95$5]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
t_1 := 1 \cdot \sin \left(\log \left(\sqrt{x.re \cdot x.re + \left|x.im\right|}\right) \cdot y.im + t\_0\right)\\
t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{t\_2 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_4 := t\_3 \cdot \sin \left(t\_2 \cdot y.im + t\_0\right)\\
t_5 := t\_3 \cdot -1\\
\mathbf{if}\;t\_4 \leq -0.2:\\
\;\;\;\;t\_5\\

\mathbf{elif}\;t\_4 \leq -2 \cdot 10^{-190}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_4 \leq 10^{-206}:\\
\;\;\;\;t\_3 \cdot 1\\

\mathbf{elif}\;t\_4 \leq 0.5:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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)))) < -0.20000000000000001 or 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))) (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 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]

    if -0.20000000000000001 < (*.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)))) < -2e-190 or 1.00000000000000003e-206 < (*.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)))) < 0.5

    1. Initial program 40.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 \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 \color{blue}{e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \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) \]
    3. Applied rewrites27.4%

      \[\leadsto \color{blue}{e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \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) \]
    4. Taylor expanded in y.im around 0

      \[\leadsto 1 \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) \]
    5. Applied rewrites13.7%

      \[\leadsto 1 \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) \]
    6. Applied rewrites14.0%

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

    if -2e-190 < (*.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.00000000000000003e-206

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 1 \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 12: 51.5% accurate, 1.3× 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}\\ \mathbf{if}\;x.re \leq -1.25 \cdot 10^{+112}:\\ \;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - t\_0} \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{elif}\;x.re \leq -2.8 \cdot 10^{-196}:\\ \;\;\;\;t\_1 \cdot \left(-1 \cdot \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \sin \left(1 + \pi\right)\\ \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))))
   (if (<= x.re -1.25e+112)
     (*
      (exp (- (* (log (* -1.0 x.re)) y.re) t_0))
      (sin (* y.re (atan2 x.im x.re))))
     (if (<= x.re -2.8e-196)
       (* t_1 (* -1.0 (* y.re (atan2 1.0 x.re))))
       (* t_1 (sin (+ 1.0 PI)))))))
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));
	double tmp;
	if (x_46_re <= -1.25e+112) {
		tmp = exp(((log((-1.0 * x_46_re)) * y_46_re) - t_0)) * sin((y_46_re * atan2(x_46_im, x_46_re)));
	} else if (x_46_re <= -2.8e-196) {
		tmp = t_1 * (-1.0 * (y_46_re * atan2(1.0, x_46_re)));
	} else {
		tmp = t_1 * sin((1.0 + ((double) M_PI)));
	}
	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_im;
	double t_1 = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0));
	double tmp;
	if (x_46_re <= -1.25e+112) {
		tmp = Math.exp(((Math.log((-1.0 * x_46_re)) * y_46_re) - t_0)) * Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re)));
	} else if (x_46_re <= -2.8e-196) {
		tmp = t_1 * (-1.0 * (y_46_re * Math.atan2(1.0, x_46_re)));
	} else {
		tmp = t_1 * Math.sin((1.0 + Math.PI));
	}
	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_im
	t_1 = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0))
	tmp = 0
	if x_46_re <= -1.25e+112:
		tmp = math.exp(((math.log((-1.0 * x_46_re)) * y_46_re) - t_0)) * math.sin((y_46_re * math.atan2(x_46_im, x_46_re)))
	elif x_46_re <= -2.8e-196:
		tmp = t_1 * (-1.0 * (y_46_re * math.atan2(1.0, x_46_re)))
	else:
		tmp = t_1 * math.sin((1.0 + math.pi))
	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 = 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))
	tmp = 0.0
	if (x_46_re <= -1.25e+112)
		tmp = Float64(exp(Float64(Float64(log(Float64(-1.0 * x_46_re)) * y_46_re) - t_0)) * sin(Float64(y_46_re * atan(x_46_im, x_46_re))));
	elseif (x_46_re <= -2.8e-196)
		tmp = Float64(t_1 * Float64(-1.0 * Float64(y_46_re * atan(1.0, x_46_re))));
	else
		tmp = Float64(t_1 * sin(Float64(1.0 + pi)));
	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_im;
	t_1 = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0));
	tmp = 0.0;
	if (x_46_re <= -1.25e+112)
		tmp = exp(((log((-1.0 * x_46_re)) * y_46_re) - t_0)) * sin((y_46_re * atan2(x_46_im, x_46_re)));
	elseif (x_46_re <= -2.8e-196)
		tmp = t_1 * (-1.0 * (y_46_re * atan2(1.0, x_46_re)));
	else
		tmp = t_1 * sin((1.0 + pi));
	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$im), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[x$46$re, -1.25e+112], N[(N[Exp[N[(N[(N[Log[N[(-1.0 * x$46$re), $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[x$46$re, -2.8e-196], N[(t$95$1 * N[(-1.0 * N[(y$46$re * N[ArcTan[1.0 / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sin[N[(1.0 + Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\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}\\
\mathbf{if}\;x.re \leq -1.25 \cdot 10^{+112}:\\
\;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - t\_0} \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\

\mathbf{elif}\;x.re \leq -2.8 \cdot 10^{-196}:\\
\;\;\;\;t\_1 \cdot \left(-1 \cdot \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sin \left(1 + \pi\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x.re < -1.25e112

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Taylor expanded in x.re around -inf

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

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

    if -1.25e112 < x.re < -2.7999999999999998e-196

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\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(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]
    6. Applied rewrites49.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 \left(-1 \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)}\right) \]

    if -2.7999999999999998e-196 < x.re

    1. Initial program 40.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 \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(\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 rewrites39.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}{\left(\sin \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right) + y.re \cdot \left(\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)} \]
    4. 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 \left(\sin \left(1 + \pi\right) + \color{blue}{y.re} \cdot \left(\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) \]
    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 \sin \left(1 + \mathsf{PI}\left(\right)\right) \]
    6. Applied rewrites48.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 \sin \left(1 + \pi\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 50.5% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_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}\\ \mathbf{if}\;y.re \leq 2 \cdot 10^{+175}:\\ \;\;\;\;t\_0 \cdot -1\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot 1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (exp
          (-
           (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
           (* (atan2 x.im x.re) y.im)))))
   (if (<= y.re 2e+175) (* t_0 -1.0) (* t_0 1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = 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)));
	double tmp;
	if (y_46_re <= 2e+175) {
		tmp = t_0 * -1.0;
	} else {
		tmp = t_0 * 1.0;
	}
	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) :: tmp
    t_0 = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
    if (y_46re <= 2d+175) then
        tmp = t_0 * (-1.0d0)
    else
        tmp = t_0 * 1.0d0
    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.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)));
	double tmp;
	if (y_46_re <= 2e+175) {
		tmp = t_0 * -1.0;
	} else {
		tmp = t_0 * 1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = 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)))
	tmp = 0
	if y_46_re <= 2e+175:
		tmp = t_0 * -1.0
	else:
		tmp = t_0 * 1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = 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)))
	tmp = 0.0
	if (y_46_re <= 2e+175)
		tmp = Float64(t_0 * -1.0);
	else
		tmp = Float64(t_0 * 1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = exp(((log(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)));
	tmp = 0.0;
	if (y_46_re <= 2e+175)
		tmp = t_0 * -1.0;
	else
		tmp = t_0 * 1.0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(N[(N[Log[N[Sqrt[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]}, If[LessEqual[y$46$re, 2e+175], N[(t$95$0 * -1.0), $MachinePrecision], N[(t$95$0 * 1.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_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}\\
\mathbf{if}\;y.re \leq 2 \cdot 10^{+175}:\\
\;\;\;\;t\_0 \cdot -1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < 1.9999999999999999e175

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]

    if 1.9999999999999999e175 < y.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 1 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 49.2% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.re \leq -1.65 \cdot 10^{-21}:\\ \;\;\;\;e^{\log \left(\pi - x.re\right) \cdot y.re - t\_0} \cdot -1\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_0} \cdot -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)))
   (if (<= x.re -1.65e-21)
     (* (exp (- (* (log (- PI x.re)) y.re) t_0)) -1.0)
     (*
      (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_0))
      -1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (x_46_re <= -1.65e-21) {
		tmp = exp(((log((((double) M_PI) - x_46_re)) * y_46_re) - t_0)) * -1.0;
	} else {
		tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (x_46_re <= -1.65e-21) {
		tmp = Math.exp(((Math.log((Math.PI - x_46_re)) * y_46_re) - t_0)) * -1.0;
	} else {
		tmp = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.atan2(x_46_im, x_46_re) * y_46_im
	tmp = 0
	if x_46_re <= -1.65e-21:
		tmp = math.exp(((math.log((math.pi - x_46_re)) * y_46_re) - t_0)) * -1.0
	else:
		tmp = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im)
	tmp = 0.0
	if (x_46_re <= -1.65e-21)
		tmp = Float64(exp(Float64(Float64(log(Float64(pi - x_46_re)) * y_46_re) - t_0)) * -1.0);
	else
		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) - t_0)) * -1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	tmp = 0.0;
	if (x_46_re <= -1.65e-21)
		tmp = exp(((log((pi - x_46_re)) * y_46_re) - t_0)) * -1.0;
	else
		tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0;
	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$im), $MachinePrecision]}, If[LessEqual[x$46$re, -1.65e-21], N[(N[Exp[N[(N[(N[Log[N[(Pi - x$46$re), $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * -1.0), $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] - t$95$0), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -1.65 \cdot 10^{-21}:\\
\;\;\;\;e^{\log \left(\pi - x.re\right) \cdot y.re - t\_0} \cdot -1\\

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


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

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites35.1%

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

    if -1.65000000000000004e-21 < x.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 48.5% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.re \leq -3.4 \cdot 10^{-306}:\\ \;\;\;\;e^{\log \left(\pi - x.re\right) \cdot y.re - t\_0} \cdot -1\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt{x.re + x.im \cdot x.im}\right) \cdot y.re - t\_0} \cdot -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)))
   (if (<= x.re -3.4e-306)
     (* (exp (- (* (log (- PI x.re)) y.re) t_0)) -1.0)
     (* (exp (- (* (log (sqrt (+ x.re (* x.im x.im)))) y.re) t_0)) -1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (x_46_re <= -3.4e-306) {
		tmp = exp(((log((((double) M_PI) - x_46_re)) * y_46_re) - t_0)) * -1.0;
	} else {
		tmp = exp(((log(sqrt((x_46_re + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (x_46_re <= -3.4e-306) {
		tmp = Math.exp(((Math.log((Math.PI - x_46_re)) * y_46_re) - t_0)) * -1.0;
	} else {
		tmp = Math.exp(((Math.log(Math.sqrt((x_46_re + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.atan2(x_46_im, x_46_re) * y_46_im
	tmp = 0
	if x_46_re <= -3.4e-306:
		tmp = math.exp(((math.log((math.pi - x_46_re)) * y_46_re) - t_0)) * -1.0
	else:
		tmp = math.exp(((math.log(math.sqrt((x_46_re + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im)
	tmp = 0.0
	if (x_46_re <= -3.4e-306)
		tmp = Float64(exp(Float64(Float64(log(Float64(pi - x_46_re)) * y_46_re) - t_0)) * -1.0);
	else
		tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(x_46_re + Float64(x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	tmp = 0.0;
	if (x_46_re <= -3.4e-306)
		tmp = exp(((log((pi - x_46_re)) * y_46_re) - t_0)) * -1.0;
	else
		tmp = exp(((log(sqrt((x_46_re + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * -1.0;
	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$im), $MachinePrecision]}, If[LessEqual[x$46$re, -3.4e-306], N[(N[Exp[N[(N[(N[Log[N[(Pi - x$46$re), $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(x$46$re + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -3.4 \cdot 10^{-306}:\\
\;\;\;\;e^{\log \left(\pi - x.re\right) \cdot y.re - t\_0} \cdot -1\\

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


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

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites35.1%

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

    if -3.3999999999999998e-306 < x.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites36.7%

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

Alternative 16: 47.5% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.re \leq 10^{-286}:\\ \;\;\;\;e^{\log \left(\pi - x.re\right) \cdot y.re - t\_0} \cdot -1\\ \mathbf{else}:\\ \;\;\;\;e^{\left(-1 \cdot \log \left(\frac{1}{x.re}\right)\right) \cdot y.re - t\_0} \cdot -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)))
   (if (<= x.re 1e-286)
     (* (exp (- (* (log (- PI x.re)) y.re) t_0)) -1.0)
     (* (exp (- (* (* -1.0 (log (/ 1.0 x.re))) y.re) t_0)) -1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (x_46_re <= 1e-286) {
		tmp = exp(((log((((double) M_PI) - x_46_re)) * y_46_re) - t_0)) * -1.0;
	} else {
		tmp = exp((((-1.0 * log((1.0 / x_46_re))) * y_46_re) - t_0)) * -1.0;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
	double tmp;
	if (x_46_re <= 1e-286) {
		tmp = Math.exp(((Math.log((Math.PI - x_46_re)) * y_46_re) - t_0)) * -1.0;
	} else {
		tmp = Math.exp((((-1.0 * Math.log((1.0 / x_46_re))) * y_46_re) - t_0)) * -1.0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.atan2(x_46_im, x_46_re) * y_46_im
	tmp = 0
	if x_46_re <= 1e-286:
		tmp = math.exp(((math.log((math.pi - x_46_re)) * y_46_re) - t_0)) * -1.0
	else:
		tmp = math.exp((((-1.0 * math.log((1.0 / x_46_re))) * y_46_re) - t_0)) * -1.0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im)
	tmp = 0.0
	if (x_46_re <= 1e-286)
		tmp = Float64(exp(Float64(Float64(log(Float64(pi - x_46_re)) * y_46_re) - t_0)) * -1.0);
	else
		tmp = Float64(exp(Float64(Float64(Float64(-1.0 * log(Float64(1.0 / x_46_re))) * y_46_re) - t_0)) * -1.0);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = atan2(x_46_im, x_46_re) * y_46_im;
	tmp = 0.0;
	if (x_46_re <= 1e-286)
		tmp = exp(((log((pi - x_46_re)) * y_46_re) - t_0)) * -1.0;
	else
		tmp = exp((((-1.0 * log((1.0 / x_46_re))) * y_46_re) - t_0)) * -1.0;
	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$im), $MachinePrecision]}, If[LessEqual[x$46$re, 1e-286], N[(N[Exp[N[(N[(N[Log[N[(Pi - x$46$re), $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision], N[(N[Exp[N[(N[(N[(-1.0 * N[Log[N[(1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;e^{\left(-1 \cdot \log \left(\frac{1}{x.re}\right)\right) \cdot y.re - t\_0} \cdot -1\\


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

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites35.1%

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

    if 1.00000000000000005e-286 < x.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Taylor expanded in x.re around inf

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

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

Alternative 17: 43.6% accurate, 2.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot \pi\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < 1.19999999999999996

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites35.1%

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

    if 1.19999999999999996 < x.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites27.2%

      \[\leadsto \color{blue}{\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 18: 30.3% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq 3.8 \cdot 10^{-308}:\\ \;\;\;\;\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot -1\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\sqrt{x.im} + -0.5 \cdot \frac{x.re}{\sqrt{x.im}}\right)}^{y.re} \cdot \pi\right) \cdot \pi\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= x.im 3.8e-308)
   (* (* (pow (- PI x.re) y.re) PI) -1.0)
   (* (* (pow (+ (sqrt x.im) (* -0.5 (/ x.re (sqrt x.im)))) y.re) PI) PI)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (x_46_im <= 3.8e-308) {
		tmp = (pow((((double) M_PI) - x_46_re), y_46_re) * ((double) M_PI)) * -1.0;
	} else {
		tmp = (pow((sqrt(x_46_im) + (-0.5 * (x_46_re / sqrt(x_46_im)))), y_46_re) * ((double) M_PI)) * ((double) M_PI);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (x_46_im <= 3.8e-308) {
		tmp = (Math.pow((Math.PI - x_46_re), y_46_re) * Math.PI) * -1.0;
	} else {
		tmp = (Math.pow((Math.sqrt(x_46_im) + (-0.5 * (x_46_re / Math.sqrt(x_46_im)))), y_46_re) * Math.PI) * Math.PI;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if x_46_im <= 3.8e-308:
		tmp = (math.pow((math.pi - x_46_re), y_46_re) * math.pi) * -1.0
	else:
		tmp = (math.pow((math.sqrt(x_46_im) + (-0.5 * (x_46_re / math.sqrt(x_46_im)))), y_46_re) * math.pi) * math.pi
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (x_46_im <= 3.8e-308)
		tmp = Float64(Float64((Float64(pi - x_46_re) ^ y_46_re) * pi) * -1.0);
	else
		tmp = Float64(Float64((Float64(sqrt(x_46_im) + Float64(-0.5 * Float64(x_46_re / sqrt(x_46_im)))) ^ y_46_re) * pi) * pi);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (x_46_im <= 3.8e-308)
		tmp = (((pi - x_46_re) ^ y_46_re) * pi) * -1.0;
	else
		tmp = (((sqrt(x_46_im) + (-0.5 * (x_46_re / sqrt(x_46_im)))) ^ y_46_re) * pi) * pi;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, 3.8e-308], N[(N[(N[Power[N[(Pi - x$46$re), $MachinePrecision], y$46$re], $MachinePrecision] * Pi), $MachinePrecision] * -1.0), $MachinePrecision], N[(N[(N[Power[N[(N[Sqrt[x$46$im], $MachinePrecision] + N[(-0.5 * N[(x$46$re / N[Sqrt[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 3.8 \cdot 10^{-308}:\\
\;\;\;\;\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot -1\\

\mathbf{else}:\\
\;\;\;\;\left({\left(\sqrt{x.im} + -0.5 \cdot \frac{x.re}{\sqrt{x.im}}\right)}^{y.re} \cdot \pi\right) \cdot \pi\\


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

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites27.1%

      \[\leadsto \color{blue}{\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right)} \cdot -1 \]

    if 3.79999999999999975e-308 < x.im

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites17.4%

      \[\leadsto \color{blue}{\left({\left(\sqrt{x.im - x.re}\right)}^{y.re} \cdot \pi\right) \cdot \pi} \]
    6. Taylor expanded in x.re around 0

      \[\leadsto \left({\color{blue}{\left(\sqrt{x.im} + \frac{-1}{2} \cdot \frac{x.re}{\sqrt{x.im}}\right)}}^{y.re} \cdot \pi\right) \cdot \pi \]
    7. Applied rewrites16.5%

      \[\leadsto \left({\color{blue}{\left(\sqrt{x.im} + -0.5 \cdot \frac{x.re}{\sqrt{x.im}}\right)}}^{y.re} \cdot \pi\right) \cdot \pi \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 27.2% accurate, 4.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\pi - x.re\right)}^{y.re} \cdot \pi\\ \mathbf{if}\;y.re \leq 6.5 \cdot 10^{+175}:\\ \;\;\;\;t\_0 \cdot -1\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \pi\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (pow (- PI x.re) y.re) PI)))
   (if (<= y.re 6.5e+175) (* t_0 -1.0) (* t_0 PI))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = pow((((double) M_PI) - x_46_re), y_46_re) * ((double) M_PI);
	double tmp;
	if (y_46_re <= 6.5e+175) {
		tmp = t_0 * -1.0;
	} else {
		tmp = t_0 * ((double) M_PI);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.pow((Math.PI - x_46_re), y_46_re) * Math.PI;
	double tmp;
	if (y_46_re <= 6.5e+175) {
		tmp = t_0 * -1.0;
	} else {
		tmp = t_0 * Math.PI;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.pow((math.pi - x_46_re), y_46_re) * math.pi
	tmp = 0
	if y_46_re <= 6.5e+175:
		tmp = t_0 * -1.0
	else:
		tmp = t_0 * math.pi
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64((Float64(pi - x_46_re) ^ y_46_re) * pi)
	tmp = 0.0
	if (y_46_re <= 6.5e+175)
		tmp = Float64(t_0 * -1.0);
	else
		tmp = Float64(t_0 * pi);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = ((pi - x_46_re) ^ y_46_re) * pi;
	tmp = 0.0;
	if (y_46_re <= 6.5e+175)
		tmp = t_0 * -1.0;
	else
		tmp = t_0 * pi;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[Power[N[(Pi - x$46$re), $MachinePrecision], y$46$re], $MachinePrecision] * Pi), $MachinePrecision]}, If[LessEqual[y$46$re, 6.5e+175], N[(t$95$0 * -1.0), $MachinePrecision], N[(t$95$0 * Pi), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\pi - x.re\right)}^{y.re} \cdot \pi\\
\mathbf{if}\;y.re \leq 6.5 \cdot 10^{+175}:\\
\;\;\;\;t\_0 \cdot -1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < 6.49999999999999977e175

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites27.1%

      \[\leadsto \color{blue}{\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right)} \cdot -1 \]

    if 6.49999999999999977e175 < y.re

    1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
    5. Applied rewrites48.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 -1 \]
    6. Applied rewrites27.2%

      \[\leadsto \color{blue}{\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot \pi} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 27.2% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot \pi \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (* (* (pow (- PI x.re) y.re) PI) PI))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return (pow((((double) M_PI) - x_46_re), y_46_re) * ((double) M_PI)) * ((double) M_PI);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return (Math.pow((Math.PI - x_46_re), y_46_re) * Math.PI) * Math.PI;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return (math.pow((math.pi - x_46_re), y_46_re) * math.pi) * math.pi
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64((Float64(pi - x_46_re) ^ y_46_re) * pi) * pi)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = (((pi - x_46_re) ^ y_46_re) * pi) * pi;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[Power[N[(Pi - x$46$re), $MachinePrecision], y$46$re], $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot \pi
\end{array}
Derivation
  1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
  3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
  4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
  5. Applied rewrites48.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 -1 \]
  6. Applied rewrites27.2%

    \[\leadsto \color{blue}{\left({\left(\pi - x.re\right)}^{y.re} \cdot \pi\right) \cdot \pi} \]
  7. Add Preprocessing

Alternative 21: 14.1% accurate, 5.1× speedup?

\[\begin{array}{l} \\ \left({\left(\sqrt{x.im}\right)}^{y.re} \cdot \pi\right) \cdot \pi \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (* (* (pow (sqrt x.im) y.re) PI) PI))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return (pow(sqrt(x_46_im), y_46_re) * ((double) M_PI)) * ((double) M_PI);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return (Math.pow(Math.sqrt(x_46_im), y_46_re) * Math.PI) * Math.PI;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return (math.pow(math.sqrt(x_46_im), y_46_re) * math.pi) * math.pi
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64((sqrt(x_46_im) ^ y_46_re) * pi) * pi)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = ((sqrt(x_46_im) ^ y_46_re) * pi) * pi;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[Power[N[Sqrt[x$46$im], $MachinePrecision], y$46$re], $MachinePrecision] * Pi), $MachinePrecision] * Pi), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(\sqrt{x.im}\right)}^{y.re} \cdot \pi\right) \cdot \pi
\end{array}
Derivation
  1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
  3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
  4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
  5. Applied rewrites17.4%

    \[\leadsto \color{blue}{\left({\left(\sqrt{x.im - x.re}\right)}^{y.re} \cdot \pi\right) \cdot \pi} \]
  6. Taylor expanded in x.re around 0

    \[\leadsto \left({\left(\sqrt{\color{blue}{x.im}}\right)}^{y.re} \cdot \pi\right) \cdot \pi \]
  7. Applied rewrites14.1%

    \[\leadsto \left({\left(\sqrt{\color{blue}{x.im}}\right)}^{y.re} \cdot \pi\right) \cdot \pi \]
  8. Add Preprocessing

Alternative 22: 3.2% accurate, 31.9× speedup?

\[\begin{array}{l} \\ \pi \cdot \pi \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (* PI PI))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((double) M_PI) * ((double) M_PI);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return Math.PI * Math.PI;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return math.pi * math.pi
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(pi * pi)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = pi * pi;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(Pi * Pi), $MachinePrecision]
\begin{array}{l}

\\
\pi \cdot \pi
\end{array}
Derivation
  1. Initial program 40.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 \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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
  3. Applied rewrites53.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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
  4. Applied rewrites49.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 \left(-\sin \left(y.re \cdot \tan^{-1}_* \frac{1}{x.re}\right)\right) \]
  5. Applied rewrites17.4%

    \[\leadsto \color{blue}{\left({\left(\sqrt{x.im - x.re}\right)}^{y.re} \cdot \pi\right) \cdot \pi} \]
  6. Taylor expanded in y.re around 0

    \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \pi \]
  7. Applied rewrites3.2%

    \[\leadsto \color{blue}{\pi} \cdot \pi \]
  8. Add Preprocessing

Reproduce

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