powComplex, real part

Percentage Accurate: 39.9% → 77.4%
Time: 7.8s
Alternatives: 12
Speedup: 3.3×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\ e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
   (*
    (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
    (cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

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 12 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: 39.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 \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
   (*
    (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
    (cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
	return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

Alternative 1: 77.4% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -9 \cdot 10^{-15}:\\ \;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{elif}\;y.re \leq 7 \cdot 10^{-5}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.re -9e-15)
   (*
    (exp
     (-
      (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
      (* (atan2 x.im x.re) y.im)))
    (cos (* y.re (atan2 x.im x.re))))
   (if (<= y.re 7e-5)
     (* (exp (* y.im (- (atan2 x.im x.re)))) (cos (* y.im (log (fabs x.re)))))
     (* (sin (* 0.5 PI)) (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= -9e-15) {
		tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_re * atan2(x_46_im, x_46_re)));
	} else if (y_46_re <= 7e-5) {
		tmp = exp((y_46_im * -atan2(x_46_im, x_46_re))) * cos((y_46_im * log(fabs(x_46_re))));
	} else {
		tmp = sin((0.5 * ((double) M_PI))) * pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re);
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_re <= -9e-15)
		tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(y_46_re * atan(x_46_im, x_46_re))));
	elseif (y_46_re <= 7e-5)
		tmp = Float64(exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))) * cos(Float64(y_46_im * log(abs(x_46_re)))));
	else
		tmp = Float64(sin(Float64(0.5 * pi)) * (sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -9e-15], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 7e-5], N[(N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Abs[x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -9 \cdot 10^{-15}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\

\mathbf{elif}\;y.re \leq 7 \cdot 10^{-5}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\


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

    1. Initial program 39.9%

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

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

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

        \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
      3. lift-atan2.f6462.1

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

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

    if -8.9999999999999995e-15 < y.re < 6.9999999999999994e-5

    1. Initial program 39.9%

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

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

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

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

        \[\leadsto e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      4. distribute-rgt-neg-inN/A

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

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

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      7. lift-atan2.f6426.8

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

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

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

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

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

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

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right) \]
      5. lift-fma.f64N/A

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)\right) \]
      6. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re}\right)\right) \]
      3. rem-sqrt-square-revN/A

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right) \]
      4. lift-log.f64N/A

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right) \]
      5. lift-fabs.f6452.1

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

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

    if 6.9999999999999994e-5 < y.re

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 76.9% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\ \mathbf{if}\;y.re \leq -1.6 \cdot 10^{-12}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 7 \cdot 10^{-5}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (* (sin (* 0.5 PI)) (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re))))
   (if (<= y.re -1.6e-12)
     t_0
     (if (<= y.re 7e-5)
       (*
        (exp (* y.im (- (atan2 x.im x.re))))
        (cos (* y.im (log (fabs x.re)))))
       t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = sin((0.5 * ((double) M_PI))) * pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re);
	double tmp;
	if (y_46_re <= -1.6e-12) {
		tmp = t_0;
	} else if (y_46_re <= 7e-5) {
		tmp = exp((y_46_im * -atan2(x_46_im, x_46_re))) * cos((y_46_im * log(fabs(x_46_re))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(sin(Float64(0.5 * pi)) * (sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re))
	tmp = 0.0
	if (y_46_re <= -1.6e-12)
		tmp = t_0;
	elseif (y_46_re <= 7e-5)
		tmp = Float64(exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))) * cos(Float64(y_46_im * log(abs(x_46_re)))));
	else
		tmp = t_0;
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.6e-12], t$95$0, If[LessEqual[y$46$re, 7e-5], N[(N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Abs[x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -1.6 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 7 \cdot 10^{-5}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -1.6e-12 or 6.9999999999999994e-5 < y.re

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]

    if -1.6e-12 < y.re < 6.9999999999999994e-5

    1. Initial program 39.9%

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

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

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

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

        \[\leadsto e^{\mathsf{neg}\left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      4. distribute-rgt-neg-inN/A

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

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

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \]
      7. lift-atan2.f6426.8

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

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

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

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

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

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

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right) \]
      5. lift-fma.f64N/A

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)\right) \]
      6. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re}\right)\right) \]
      3. rem-sqrt-square-revN/A

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right) \]
      4. lift-log.f64N/A

        \[\leadsto e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \cos \left(y.im \cdot \log \left(\left|x.re\right|\right)\right) \]
      5. lift-fabs.f6452.1

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

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

Alternative 3: 61.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \pi\right)\\ \mathbf{if}\;x.re \leq -1.45 \cdot 10^{+129}:\\ \;\;\;\;t\_0 \cdot {\left(\left|x.re\right|\right)}^{y.re}\\ \mathbf{elif}\;x.re \leq 2.8 \cdot 10^{-174}:\\ \;\;\;\;t\_0 \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re}\\ \mathbf{elif}\;x.re \leq 9.5 \cdot 10^{+36}:\\ \;\;\;\;\cos \left(y.im \cdot \log x.re\right) \cdot e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.re}^{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 PI))))
   (if (<= x.re -1.45e+129)
     (* t_0 (pow (fabs x.re) y.re))
     (if (<= x.re 2.8e-174)
       (* t_0 (pow (sqrt (* x.im x.im)) y.re))
       (if (<= x.re 9.5e+36)
         (* (cos (* y.im (log x.re))) (exp (- (* y.im (atan2 x.im x.re)))))
         (* (cos (* y.re (atan2 x.im x.re))) (pow 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 = sin((0.5 * ((double) M_PI)));
	double tmp;
	if (x_46_re <= -1.45e+129) {
		tmp = t_0 * pow(fabs(x_46_re), y_46_re);
	} else if (x_46_re <= 2.8e-174) {
		tmp = t_0 * pow(sqrt((x_46_im * x_46_im)), y_46_re);
	} else if (x_46_re <= 9.5e+36) {
		tmp = cos((y_46_im * log(x_46_re))) * exp(-(y_46_im * atan2(x_46_im, x_46_re)));
	} else {
		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(x_46_re, y_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.sin((0.5 * Math.PI));
	double tmp;
	if (x_46_re <= -1.45e+129) {
		tmp = t_0 * Math.pow(Math.abs(x_46_re), y_46_re);
	} else if (x_46_re <= 2.8e-174) {
		tmp = t_0 * Math.pow(Math.sqrt((x_46_im * x_46_im)), y_46_re);
	} else if (x_46_re <= 9.5e+36) {
		tmp = Math.cos((y_46_im * Math.log(x_46_re))) * Math.exp(-(y_46_im * Math.atan2(x_46_im, x_46_re)));
	} else {
		tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(x_46_re, y_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.sin((0.5 * math.pi))
	tmp = 0
	if x_46_re <= -1.45e+129:
		tmp = t_0 * math.pow(math.fabs(x_46_re), y_46_re)
	elif x_46_re <= 2.8e-174:
		tmp = t_0 * math.pow(math.sqrt((x_46_im * x_46_im)), y_46_re)
	elif x_46_re <= 9.5e+36:
		tmp = math.cos((y_46_im * math.log(x_46_re))) * math.exp(-(y_46_im * math.atan2(x_46_im, x_46_re)))
	else:
		tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(x_46_re, y_46_re)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = sin(Float64(0.5 * pi))
	tmp = 0.0
	if (x_46_re <= -1.45e+129)
		tmp = Float64(t_0 * (abs(x_46_re) ^ y_46_re));
	elseif (x_46_re <= 2.8e-174)
		tmp = Float64(t_0 * (sqrt(Float64(x_46_im * x_46_im)) ^ y_46_re));
	elseif (x_46_re <= 9.5e+36)
		tmp = Float64(cos(Float64(y_46_im * log(x_46_re))) * exp(Float64(-Float64(y_46_im * atan(x_46_im, x_46_re)))));
	else
		tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (x_46_re ^ y_46_re));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = sin((0.5 * pi));
	tmp = 0.0;
	if (x_46_re <= -1.45e+129)
		tmp = t_0 * (abs(x_46_re) ^ y_46_re);
	elseif (x_46_re <= 2.8e-174)
		tmp = t_0 * (sqrt((x_46_im * x_46_im)) ^ y_46_re);
	elseif (x_46_re <= 9.5e+36)
		tmp = cos((y_46_im * log(x_46_re))) * exp(-(y_46_im * atan2(x_46_im, x_46_re)));
	else
		tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (x_46_re ^ y_46_re);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -1.45e+129], N[(t$95$0 * N[Power[N[Abs[x$46$re], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2.8e-174], N[(t$95$0 * N[Power[N[Sqrt[N[(x$46$im * x$46$im), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 9.5e+36], N[(N[Cos[N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[(-N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[x$46$re, y$46$re], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \pi\right)\\
\mathbf{if}\;x.re \leq -1.45 \cdot 10^{+129}:\\
\;\;\;\;t\_0 \cdot {\left(\left|x.re\right|\right)}^{y.re}\\

\mathbf{elif}\;x.re \leq 2.8 \cdot 10^{-174}:\\
\;\;\;\;t\_0 \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re}\\

\mathbf{elif}\;x.re \leq 9.5 \cdot 10^{+36}:\\
\;\;\;\;\cos \left(y.im \cdot \log x.re\right) \cdot e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

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


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

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
    10. Taylor expanded in x.im around 0

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{\color{blue}{y.re}} \]
    11. Step-by-step derivation
      1. lower-pow.f64N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{y.re} \]
      2. pow2N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{x.re \cdot x.re}\right)}^{y.re} \]
      3. rem-sqrt-square-revN/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
      4. lift-fabs.f6453.6

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
    12. Applied rewrites53.6%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{\color{blue}{y.re}} \]

    if -1.45000000000000001e129 < x.re < 2.79999999999999999e-174

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
    10. Taylor expanded in x.re around 0

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.im}^{2}}\right)}^{y.re} \]
    11. Step-by-step derivation
      1. pow2N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re} \]
      2. lift-*.f6445.3

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re} \]
    12. Applied rewrites45.3%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re} \]

    if 2.79999999999999999e-174 < x.re < 9.49999999999999974e36

    1. Initial program 39.9%

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

      \[\leadsto \color{blue}{\cos \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) \cdot 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}}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \cos \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) \cdot \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}}} \]
      2. lower-cos.f64N/A

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

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

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

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

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

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

        \[\leadsto \cos \left(\mathsf{fma}\left(-1, y.im \cdot \left(-\log x.re\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot 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}} \]
      9. lift-atan2.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.im \cdot \log x.re\right) \cdot e^{-y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \]
      7. lift-atan2.f64N/A

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

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

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

    if 9.49999999999999974e36 < x.re

    1. Initial program 39.9%

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

      \[\leadsto \color{blue}{\cos \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) \cdot 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}}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \cos \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) \cdot \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}}} \]
      2. lower-cos.f64N/A

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

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

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

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

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

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

        \[\leadsto \cos \left(\mathsf{fma}\left(-1, y.im \cdot \left(-\log x.re\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot 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}} \]
      9. lift-atan2.f64N/A

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.re}^{y.re} \]
      3. lift-*.f64N/A

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.re}^{y.re} \]
      5. lower-pow.f6438.8

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {x.re}^{y.re} \]
    7. Applied rewrites38.8%

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

Alternative 4: 57.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\ \mathbf{if}\;y.re \leq -1.4 \cdot 10^{-100}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-6}:\\ \;\;\;\;1 + y.re \cdot \log \left(\left|x.re\right|\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (* (sin (* 0.5 PI)) (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re))))
   (if (<= y.re -1.4e-100)
     t_0
     (if (<= y.re 1.6e-6) (+ 1.0 (* y.re (log (fabs x.re)))) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = sin((0.5 * ((double) M_PI))) * pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re);
	double tmp;
	if (y_46_re <= -1.4e-100) {
		tmp = t_0;
	} else if (y_46_re <= 1.6e-6) {
		tmp = 1.0 + (y_46_re * log(fabs(x_46_re)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(sin(Float64(0.5 * pi)) * (sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re))
	tmp = 0.0
	if (y_46_re <= -1.4e-100)
		tmp = t_0;
	elseif (y_46_re <= 1.6e-6)
		tmp = Float64(1.0 + Float64(y_46_re * log(abs(x_46_re))));
	else
		tmp = t_0;
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.4e-100], t$95$0, If[LessEqual[y$46$re, 1.6e-6], N[(1.0 + N[(y$46$re * N[Log[N[Abs[x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-100}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-6}:\\
\;\;\;\;1 + y.re \cdot \log \left(\left|x.re\right|\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -1.39999999999999998e-100 or 1.5999999999999999e-6 < y.re

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]

    if -1.39999999999999998e-100 < y.re < 1.5999999999999999e-6

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
    9. Step-by-step derivation
      1. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      2. rem-sqrt-squareN/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      3. lower-fabs.f6425.7

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    10. Applied rewrites25.7%

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 55.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \pi\right)\\ t_1 := t\_0 \cdot {\left(\left|x.re\right|\right)}^{y.re}\\ \mathbf{if}\;x.re \leq -1.45 \cdot 10^{+129}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x.re \leq 6.6 \cdot 10^{-145}:\\ \;\;\;\;t\_0 \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 PI))) (t_1 (* t_0 (pow (fabs x.re) y.re))))
   (if (<= x.re -1.45e+129)
     t_1
     (if (<= x.re 6.6e-145) (* t_0 (pow (sqrt (* x.im x.im)) y.re)) t_1))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = sin((0.5 * ((double) M_PI)));
	double t_1 = t_0 * pow(fabs(x_46_re), y_46_re);
	double tmp;
	if (x_46_re <= -1.45e+129) {
		tmp = t_1;
	} else if (x_46_re <= 6.6e-145) {
		tmp = t_0 * pow(sqrt((x_46_im * x_46_im)), y_46_re);
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = Math.sin((0.5 * Math.PI));
	double t_1 = t_0 * Math.pow(Math.abs(x_46_re), y_46_re);
	double tmp;
	if (x_46_re <= -1.45e+129) {
		tmp = t_1;
	} else if (x_46_re <= 6.6e-145) {
		tmp = t_0 * Math.pow(Math.sqrt((x_46_im * x_46_im)), y_46_re);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = math.sin((0.5 * math.pi))
	t_1 = t_0 * math.pow(math.fabs(x_46_re), y_46_re)
	tmp = 0
	if x_46_re <= -1.45e+129:
		tmp = t_1
	elif x_46_re <= 6.6e-145:
		tmp = t_0 * math.pow(math.sqrt((x_46_im * x_46_im)), y_46_re)
	else:
		tmp = t_1
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = sin(Float64(0.5 * pi))
	t_1 = Float64(t_0 * (abs(x_46_re) ^ y_46_re))
	tmp = 0.0
	if (x_46_re <= -1.45e+129)
		tmp = t_1;
	elseif (x_46_re <= 6.6e-145)
		tmp = Float64(t_0 * (sqrt(Float64(x_46_im * x_46_im)) ^ y_46_re));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = sin((0.5 * pi));
	t_1 = t_0 * (abs(x_46_re) ^ y_46_re);
	tmp = 0.0;
	if (x_46_re <= -1.45e+129)
		tmp = t_1;
	elseif (x_46_re <= 6.6e-145)
		tmp = t_0 * (sqrt((x_46_im * x_46_im)) ^ y_46_re);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Power[N[Abs[x$46$re], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -1.45e+129], t$95$1, If[LessEqual[x$46$re, 6.6e-145], N[(t$95$0 * N[Power[N[Sqrt[N[(x$46$im * x$46$im), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \pi\right)\\
t_1 := t\_0 \cdot {\left(\left|x.re\right|\right)}^{y.re}\\
\mathbf{if}\;x.re \leq -1.45 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x.re \leq 6.6 \cdot 10^{-145}:\\
\;\;\;\;t\_0 \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -1.45000000000000001e129 or 6.59999999999999962e-145 < x.re

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
    10. Taylor expanded in x.im around 0

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{\color{blue}{y.re}} \]
    11. Step-by-step derivation
      1. lower-pow.f64N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{y.re} \]
      2. pow2N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{x.re \cdot x.re}\right)}^{y.re} \]
      3. rem-sqrt-square-revN/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
      4. lift-fabs.f6453.6

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
    12. Applied rewrites53.6%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{\color{blue}{y.re}} \]

    if -1.45000000000000001e129 < x.re < 6.59999999999999962e-145

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
    10. Taylor expanded in x.re around 0

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.im}^{2}}\right)}^{y.re} \]
    11. Step-by-step derivation
      1. pow2N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re} \]
      2. lift-*.f6445.3

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{x.im \cdot x.im}\right)}^{y.re} \]
    12. Applied rewrites45.3%

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

Alternative 6: 54.8% accurate, 2.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(\left|x.re\right|\right)}^{y.re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -2.20000000000000008e23

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
    10. Taylor expanded in x.im around -inf

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(-1 \cdot x.im\right)}^{y.re} \]
    11. Step-by-step derivation
      1. lower-*.f6439.8

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(-1 \cdot x.im\right)}^{y.re} \]
    12. Applied rewrites39.8%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(-1 \cdot x.im\right)}^{y.re} \]

    if -2.20000000000000008e23 < x.im

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
    6. Applied rewrites52.5%

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

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

        \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
      2. lift-PI.f6454.7

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    9. Applied rewrites54.7%

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
    10. Taylor expanded in x.im around 0

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{\color{blue}{y.re}} \]
    11. Step-by-step derivation
      1. lower-pow.f64N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{y.re} \]
      2. pow2N/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{x.re \cdot x.re}\right)}^{y.re} \]
      3. rem-sqrt-square-revN/A

        \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
      4. lift-fabs.f6453.6

        \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
    12. Applied rewrites53.6%

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

Alternative 7: 53.6% accurate, 2.3× speedup?

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

\\
\sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re}
\end{array}
Derivation
  1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
    9. pow2N/A

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    10. lift-*.f6452.5

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
  4. Applied rewrites52.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, \color{blue}{x.re} \cdot x.re\right)}\right)}^{y.re} \]
  6. Applied rewrites52.5%

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

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

      \[\leadsto \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, \color{blue}{x.im}, x.re \cdot x.re\right)}\right)}^{y.re} \]
    2. lift-PI.f6454.7

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
  9. Applied rewrites54.7%

    \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\sqrt{\color{blue}{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}}\right)}^{y.re} \]
  10. Taylor expanded in x.im around 0

    \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{\color{blue}{y.re}} \]
  11. Step-by-step derivation
    1. lower-pow.f64N/A

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{{x.re}^{2}}\right)}^{y.re} \]
    2. pow2N/A

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\sqrt{x.re \cdot x.re}\right)}^{y.re} \]
    3. rem-sqrt-square-revN/A

      \[\leadsto \sin \left(\frac{1}{2} \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
    4. lift-fabs.f6453.6

      \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{y.re} \]
  12. Applied rewrites53.6%

    \[\leadsto \sin \left(0.5 \cdot \pi\right) \cdot {\left(\left|x.re\right|\right)}^{\color{blue}{y.re}} \]
  13. Add Preprocessing

Alternative 8: 40.6% accurate, 3.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq 10^{+15}:\\ \;\;\;\;1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \log \left({\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.re 1e+15)
   (+ 1.0 (log (pow (fabs x.re) y.re)))
   (+ 1.0 (log (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= 1e+15) {
		tmp = 1.0 + log(pow(fabs(x_46_re), y_46_re));
	} else {
		tmp = 1.0 + log(pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_re <= 1e+15)
		tmp = Float64(1.0 + log((abs(x_46_re) ^ y_46_re)));
	else
		tmp = Float64(1.0 + log((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re)));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, 1e+15], N[(1.0 + N[Log[N[Power[N[Abs[x$46$re], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[Log[N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq 10^{+15}:\\
\;\;\;\;1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right)\\

\mathbf{else}:\\
\;\;\;\;1 + \log \left({\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\right)\\


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

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
    9. Step-by-step derivation
      1. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      2. rem-sqrt-squareN/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      3. lower-fabs.f6425.7

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    10. Applied rewrites25.7%

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      2. lift-log.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      3. log-pow-revN/A

        \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]
      4. lower-log.f64N/A

        \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]
      5. lower-pow.f6438.2

        \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]
    12. Applied rewrites38.2%

      \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]

    if 1e15 < y.re

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

      \[\leadsto 1 + \color{blue}{y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      2. lift-log.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      3. lift-sqrt.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      4. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      5. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. log-pow-revN/A

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

        \[\leadsto 1 + \log \left({\left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)}^{y.re}\right) \]
      8. lift-fma.f64N/A

        \[\leadsto 1 + \log \left({\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\right) \]
      9. lift-*.f64N/A

        \[\leadsto 1 + \log \left({\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\right) \]
      10. lift-sqrt.f64N/A

        \[\leadsto 1 + \log \left({\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\right) \]
      11. lift-pow.f6431.9

        \[\leadsto 1 + \log \left({\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\right) \]
    9. Applied rewrites31.9%

      \[\leadsto 1 + \log \left({\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 38.2% accurate, 4.8× speedup?

\[\begin{array}{l} \\ 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (+ 1.0 (log (pow (fabs x.re) y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return 1.0 + log(pow(fabs(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
    code = 1.0d0 + log((abs(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) {
	return 1.0 + Math.log(Math.pow(Math.abs(x_46_re), y_46_re));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return 1.0 + math.log(math.pow(math.fabs(x_46_re), y_46_re))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(1.0 + log((abs(x_46_re) ^ y_46_re)))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 1.0 + log((abs(x_46_re) ^ y_46_re));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 + N[Log[N[Power[N[Abs[x$46$re], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right)
\end{array}
Derivation
  1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
    9. pow2N/A

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    10. lift-*.f6452.5

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
  4. Applied rewrites52.5%

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

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

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

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

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

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
    6. lift-fma.f64N/A

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. lift-*.f64N/A

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    8. lift-sqrt.f6424.7

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
  7. Applied rewrites24.7%

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

    \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
  9. Step-by-step derivation
    1. pow2N/A

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
    2. rem-sqrt-squareN/A

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    3. lower-fabs.f6425.7

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
  10. Applied rewrites25.7%

    \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
  11. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    2. lift-log.f64N/A

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    3. log-pow-revN/A

      \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]
    4. lower-log.f64N/A

      \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]
    5. lower-pow.f6438.2

      \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]
  12. Applied rewrites38.2%

    \[\leadsto 1 + \log \left({\left(\left|x.re\right|\right)}^{y.re}\right) \]
  13. Add Preprocessing

Alternative 10: 33.9% accurate, 4.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.8 \cdot 10^{-21}:\\ \;\;\;\;1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right)\\ \mathbf{elif}\;y.re \leq 1.7 \cdot 10^{-9}:\\ \;\;\;\;1 + y.re \cdot \log \left(\left|x.re\right|\right)\\ \mathbf{else}:\\ \;\;\;\;1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.re -2.8e-21)
   (+ 1.0 (* y.re (log (sqrt (* x.re x.re)))))
   (if (<= y.re 1.7e-9)
     (+ 1.0 (* y.re (log (fabs x.re))))
     (+ 1.0 (* y.re (log (sqrt (fma x.im x.im (* x.re x.re)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= -2.8e-21) {
		tmp = 1.0 + (y_46_re * log(sqrt((x_46_re * x_46_re))));
	} else if (y_46_re <= 1.7e-9) {
		tmp = 1.0 + (y_46_re * log(fabs(x_46_re)));
	} else {
		tmp = 1.0 + (y_46_re * log(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re)))));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_re <= -2.8e-21)
		tmp = Float64(1.0 + Float64(y_46_re * log(sqrt(Float64(x_46_re * x_46_re)))));
	elseif (y_46_re <= 1.7e-9)
		tmp = Float64(1.0 + Float64(y_46_re * log(abs(x_46_re))));
	else
		tmp = Float64(1.0 + Float64(y_46_re * log(sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))))));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -2.8e-21], N[(1.0 + N[(y$46$re * N[Log[N[Sqrt[N[(x$46$re * x$46$re), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.7e-9], N[(1.0 + N[(y$46$re * N[Log[N[Abs[x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y$46$re * N[Log[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.8 \cdot 10^{-21}:\\
\;\;\;\;1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right)\\

\mathbf{elif}\;y.re \leq 1.7 \cdot 10^{-9}:\\
\;\;\;\;1 + y.re \cdot \log \left(\left|x.re\right|\right)\\

\mathbf{else}:\\
\;\;\;\;1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)\\


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

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
    9. Step-by-step derivation
      1. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      2. rem-sqrt-squareN/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      3. lower-fabs.f6425.7

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    10. Applied rewrites25.7%

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    11. Step-by-step derivation
      1. lift-fabs.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      2. rem-sqrt-square-revN/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      3. pow2N/A

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
      5. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      6. lift-*.f6422.6

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
    12. Applied rewrites22.6%

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]

    if -2.80000000000000004e-21 < y.re < 1.6999999999999999e-9

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
    9. Step-by-step derivation
      1. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      2. rem-sqrt-squareN/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      3. lower-fabs.f6425.7

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    10. Applied rewrites25.7%

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]

    if 1.6999999999999999e-9 < y.re

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

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

Alternative 11: 31.4% accurate, 5.1× speedup?

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

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

\mathbf{elif}\;y.re \leq 6200000:\\
\;\;\;\;1 + y.re \cdot \log \left(\left|x.re\right|\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -2.80000000000000004e-21 or 6.2e6 < y.re

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
    9. Step-by-step derivation
      1. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      2. rem-sqrt-squareN/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      3. lower-fabs.f6425.7

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    10. Applied rewrites25.7%

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    11. Step-by-step derivation
      1. lift-fabs.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      2. rem-sqrt-square-revN/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      3. pow2N/A

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
      5. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      6. lift-*.f6422.6

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
    12. Applied rewrites22.6%

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]

    if -2.80000000000000004e-21 < y.re < 6.2e6

    1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
      9. pow2N/A

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
      10. lift-*.f6452.5

        \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    4. Applied rewrites52.5%

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

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

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

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

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

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

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
      6. lift-fma.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      7. lift-*.f64N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
      8. lift-sqrt.f6424.7

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. Applied rewrites24.7%

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
    9. Step-by-step derivation
      1. pow2N/A

        \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
      2. rem-sqrt-squareN/A

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
      3. lower-fabs.f6425.7

        \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    10. Applied rewrites25.7%

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 25.7% accurate, 9.3× speedup?

\[\begin{array}{l} \\ 1 + y.re \cdot \log \left(\left|x.re\right|\right) \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (+ 1.0 (* y.re (log (fabs x.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return 1.0 + (y_46_re * log(fabs(x_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
    code = 1.0d0 + (y_46re * log(abs(x_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return 1.0 + (y_46_re * Math.log(Math.abs(x_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return 1.0 + (y_46_re * math.log(math.fabs(x_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(1.0 + Float64(y_46_re * log(abs(x_46_re))))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 1.0 + (y_46_re * log(abs(x_46_re)));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 + N[(y$46$re * N[Log[N[Abs[x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + y.re \cdot \log \left(\left|x.re\right|\right)
\end{array}
Derivation
  1. Initial program 39.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, {x.re}^{2}\right)}\right)}^{y.re} \]
    9. pow2N/A

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
    10. lift-*.f6452.5

      \[\leadsto \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \]
  4. Applied rewrites52.5%

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

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

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

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

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

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

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \]
    6. lift-fma.f64N/A

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    7. lift-*.f64N/A

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
    8. lift-sqrt.f6424.7

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \]
  7. Applied rewrites24.7%

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

    \[\leadsto 1 + y.re \cdot \log \left(\sqrt{{x.re}^{2}}\right) \]
  9. Step-by-step derivation
    1. pow2N/A

      \[\leadsto 1 + y.re \cdot \log \left(\sqrt{x.re \cdot x.re}\right) \]
    2. rem-sqrt-squareN/A

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
    3. lower-fabs.f6425.7

      \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
  10. Applied rewrites25.7%

    \[\leadsto 1 + y.re \cdot \log \left(\left|x.re\right|\right) \]
  11. Add Preprocessing

Reproduce

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