_divideComplex, imaginary part

Percentage Accurate: 61.5% → 89.0%
Time: 13.6s
Alternatives: 12
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ \frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 61.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}

Alternative 1: 89.0% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_1 := {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}\\ t_2 := t_0 - y.im \cdot \frac{x.re}{t_1}\\ \mathbf{if}\;y.im \leq -3.8 \cdot 10^{+101}:\\ \;\;\;\;\frac{x.im}{\frac{t_1}{y.re}} - \frac{y.im \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-113}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{-163}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 4.8 \cdot 10^{+87}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0 - \frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (/ y.re (hypot y.re y.im)) (/ x.im (hypot y.re y.im))))
        (t_1 (pow (hypot y.re y.im) 2.0))
        (t_2 (- t_0 (* y.im (/ x.re t_1)))))
   (if (<= y.im -3.8e+101)
     (-
      (/ x.im (/ t_1 y.re))
      (/ (* y.im (/ x.re (hypot y.re y.im))) (hypot y.re y.im)))
     (if (<= y.im -2.9e-113)
       t_2
       (if (<= y.im 2.3e-163)
         (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))
         (if (<= y.im 4.8e+87) t_2 (- t_0 (/ x.re y.im))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im));
	double t_1 = pow(hypot(y_46_re, y_46_im), 2.0);
	double t_2 = t_0 - (y_46_im * (x_46_re / t_1));
	double tmp;
	if (y_46_im <= -3.8e+101) {
		tmp = (x_46_im / (t_1 / y_46_re)) - ((y_46_im * (x_46_re / hypot(y_46_re, y_46_im))) / hypot(y_46_re, y_46_im));
	} else if (y_46_im <= -2.9e-113) {
		tmp = t_2;
	} else if (y_46_im <= 2.3e-163) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 4.8e+87) {
		tmp = t_2;
	} else {
		tmp = t_0 - (x_46_re / y_46_im);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (y_46_re / Math.hypot(y_46_re, y_46_im)) * (x_46_im / Math.hypot(y_46_re, y_46_im));
	double t_1 = Math.pow(Math.hypot(y_46_re, y_46_im), 2.0);
	double t_2 = t_0 - (y_46_im * (x_46_re / t_1));
	double tmp;
	if (y_46_im <= -3.8e+101) {
		tmp = (x_46_im / (t_1 / y_46_re)) - ((y_46_im * (x_46_re / Math.hypot(y_46_re, y_46_im))) / Math.hypot(y_46_re, y_46_im));
	} else if (y_46_im <= -2.9e-113) {
		tmp = t_2;
	} else if (y_46_im <= 2.3e-163) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 4.8e+87) {
		tmp = t_2;
	} else {
		tmp = t_0 - (x_46_re / y_46_im);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = (y_46_re / math.hypot(y_46_re, y_46_im)) * (x_46_im / math.hypot(y_46_re, y_46_im))
	t_1 = math.pow(math.hypot(y_46_re, y_46_im), 2.0)
	t_2 = t_0 - (y_46_im * (x_46_re / t_1))
	tmp = 0
	if y_46_im <= -3.8e+101:
		tmp = (x_46_im / (t_1 / y_46_re)) - ((y_46_im * (x_46_re / math.hypot(y_46_re, y_46_im))) / math.hypot(y_46_re, y_46_im))
	elif y_46_im <= -2.9e-113:
		tmp = t_2
	elif y_46_im <= 2.3e-163:
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	elif y_46_im <= 4.8e+87:
		tmp = t_2
	else:
		tmp = t_0 - (x_46_re / y_46_im)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(y_46_re / hypot(y_46_re, y_46_im)) * Float64(x_46_im / hypot(y_46_re, y_46_im)))
	t_1 = hypot(y_46_re, y_46_im) ^ 2.0
	t_2 = Float64(t_0 - Float64(y_46_im * Float64(x_46_re / t_1)))
	tmp = 0.0
	if (y_46_im <= -3.8e+101)
		tmp = Float64(Float64(x_46_im / Float64(t_1 / y_46_re)) - Float64(Float64(y_46_im * Float64(x_46_re / hypot(y_46_re, y_46_im))) / hypot(y_46_re, y_46_im)));
	elseif (y_46_im <= -2.9e-113)
		tmp = t_2;
	elseif (y_46_im <= 2.3e-163)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	elseif (y_46_im <= 4.8e+87)
		tmp = t_2;
	else
		tmp = Float64(t_0 - Float64(x_46_re / y_46_im));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = (y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im));
	t_1 = hypot(y_46_re, y_46_im) ^ 2.0;
	t_2 = t_0 - (y_46_im * (x_46_re / t_1));
	tmp = 0.0;
	if (y_46_im <= -3.8e+101)
		tmp = (x_46_im / (t_1 / y_46_re)) - ((y_46_im * (x_46_re / hypot(y_46_re, y_46_im))) / hypot(y_46_re, y_46_im));
	elseif (y_46_im <= -2.9e-113)
		tmp = t_2;
	elseif (y_46_im <= 2.3e-163)
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	elseif (y_46_im <= 4.8e+87)
		tmp = t_2;
	else
		tmp = t_0 - (x_46_re / y_46_im);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - N[(y$46$im * N[(x$46$re / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.8e+101], N[(N[(x$46$im / N[(t$95$1 / y$46$re), $MachinePrecision]), $MachinePrecision] - N[(N[(y$46$im * N[(x$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -2.9e-113], t$95$2, If[LessEqual[y$46$im, 2.3e-163], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.8e+87], t$95$2, N[(t$95$0 - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_1 := {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}\\
t_2 := t_0 - y.im \cdot \frac{x.re}{t_1}\\
\mathbf{if}\;y.im \leq -3.8 \cdot 10^{+101}:\\
\;\;\;\;\frac{x.im}{\frac{t_1}{y.re}} - \frac{y.im \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\

\mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-113}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y.im \leq 2.3 \cdot 10^{-163}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\

\mathbf{elif}\;y.im \leq 4.8 \cdot 10^{+87}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_0 - \frac{x.re}{y.im}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -3.7999999999999998e101

    1. Initial program 39.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub39.5%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg39.5%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt39.5%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow239.5%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def39.5%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*48.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt48.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow248.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def48.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr48.1%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg48.1%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*46.5%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/44.6%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified44.6%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. *-un-lft-identity44.6%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{\color{blue}{1 \cdot x.re}}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. unpow244.6%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{1 \cdot x.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
      3. times-frac73.4%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} \cdot y.im \]
    8. Applied egg-rr73.4%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} \cdot y.im \]
    9. Step-by-step derivation
      1. associate-*l/73.6%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{1 \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
      2. *-lft-identity73.6%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{\color{blue}{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.im \]
    10. Simplified73.6%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
    11. Step-by-step derivation
      1. associate-*l/90.3%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}} \]
    12. Applied egg-rr90.3%

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

    if -3.7999999999999998e101 < y.im < -2.90000000000000004e-113 or 2.2999999999999999e-163 < y.im < 4.79999999999999963e87

    1. Initial program 72.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub72.1%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg72.1%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt72.1%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow272.1%

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

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*73.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt73.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow273.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def73.1%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr73.1%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg73.1%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*75.6%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/73.0%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified73.0%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. div-inv72.9%

        \[\leadsto \color{blue}{x.im \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. clear-num72.9%

        \[\leadsto x.im \cdot \color{blue}{\frac{y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      3. div-inv72.9%

        \[\leadsto x.im \cdot \color{blue}{\left(y.re \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      4. associate-*l*70.3%

        \[\leadsto \color{blue}{\left(x.im \cdot y.re\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      5. *-commutative70.3%

        \[\leadsto \color{blue}{\left(y.re \cdot x.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      6. div-inv70.4%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      7. unpow270.4%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      8. times-frac92.5%

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    8. Applied egg-rr92.5%

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

    if -2.90000000000000004e-113 < y.im < 2.2999999999999999e-163

    1. Initial program 65.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 73.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative73.5%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg73.5%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg73.5%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*74.2%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified74.2%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow274.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv74.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*87.1%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr87.1%

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

    if 4.79999999999999963e87 < y.im

    1. Initial program 36.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub36.5%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg36.5%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt36.5%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow236.5%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def36.5%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*39.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt39.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow239.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def39.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr39.8%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg39.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*40.4%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/36.6%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified36.6%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. div-inv36.6%

        \[\leadsto \color{blue}{x.im \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. clear-num36.5%

        \[\leadsto x.im \cdot \color{blue}{\frac{y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      3. div-inv36.5%

        \[\leadsto x.im \cdot \color{blue}{\left(y.re \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      4. associate-*l*36.0%

        \[\leadsto \color{blue}{\left(x.im \cdot y.re\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      5. *-commutative36.0%

        \[\leadsto \color{blue}{\left(y.re \cdot x.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      6. div-inv36.0%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      7. unpow236.0%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      8. times-frac53.6%

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    8. Applied egg-rr53.6%

      \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    9. Taylor expanded in y.re around 0 94.1%

      \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \color{blue}{\frac{x.re}{y.im}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification91.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -3.8 \cdot 10^{+101}:\\ \;\;\;\;\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{y.im \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-113}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{-163}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 4.8 \cdot 10^{+87}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 90.3% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_1 := t_0 - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\ t_2 := t_0 - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -6.8 \cdot 10^{+105}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 6.6 \cdot 10^{-163}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 4.8 \cdot 10^{+87}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (/ y.re (hypot y.re y.im)) (/ x.im (hypot y.re y.im))))
        (t_1 (- t_0 (* y.im (/ x.re (pow (hypot y.re y.im) 2.0)))))
        (t_2 (- t_0 (/ x.re y.im))))
   (if (<= y.im -6.8e+105)
     t_2
     (if (<= y.im -2.9e-113)
       t_1
       (if (<= y.im 6.6e-163)
         (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))
         (if (<= y.im 4.8e+87) t_1 t_2))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im));
	double t_1 = t_0 - (y_46_im * (x_46_re / pow(hypot(y_46_re, y_46_im), 2.0)));
	double t_2 = t_0 - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -6.8e+105) {
		tmp = t_2;
	} else if (y_46_im <= -2.9e-113) {
		tmp = t_1;
	} else if (y_46_im <= 6.6e-163) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 4.8e+87) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (y_46_re / Math.hypot(y_46_re, y_46_im)) * (x_46_im / Math.hypot(y_46_re, y_46_im));
	double t_1 = t_0 - (y_46_im * (x_46_re / Math.pow(Math.hypot(y_46_re, y_46_im), 2.0)));
	double t_2 = t_0 - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -6.8e+105) {
		tmp = t_2;
	} else if (y_46_im <= -2.9e-113) {
		tmp = t_1;
	} else if (y_46_im <= 6.6e-163) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 4.8e+87) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = (y_46_re / math.hypot(y_46_re, y_46_im)) * (x_46_im / math.hypot(y_46_re, y_46_im))
	t_1 = t_0 - (y_46_im * (x_46_re / math.pow(math.hypot(y_46_re, y_46_im), 2.0)))
	t_2 = t_0 - (x_46_re / y_46_im)
	tmp = 0
	if y_46_im <= -6.8e+105:
		tmp = t_2
	elif y_46_im <= -2.9e-113:
		tmp = t_1
	elif y_46_im <= 6.6e-163:
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	elif y_46_im <= 4.8e+87:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(y_46_re / hypot(y_46_re, y_46_im)) * Float64(x_46_im / hypot(y_46_re, y_46_im)))
	t_1 = Float64(t_0 - Float64(y_46_im * Float64(x_46_re / (hypot(y_46_re, y_46_im) ^ 2.0))))
	t_2 = Float64(t_0 - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -6.8e+105)
		tmp = t_2;
	elseif (y_46_im <= -2.9e-113)
		tmp = t_1;
	elseif (y_46_im <= 6.6e-163)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	elseif (y_46_im <= 4.8e+87)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = (y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im));
	t_1 = t_0 - (y_46_im * (x_46_re / (hypot(y_46_re, y_46_im) ^ 2.0)));
	t_2 = t_0 - (x_46_re / y_46_im);
	tmp = 0.0;
	if (y_46_im <= -6.8e+105)
		tmp = t_2;
	elseif (y_46_im <= -2.9e-113)
		tmp = t_1;
	elseif (y_46_im <= 6.6e-163)
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	elseif (y_46_im <= 4.8e+87)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(y$46$im * N[(x$46$re / N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -6.8e+105], t$95$2, If[LessEqual[y$46$im, -2.9e-113], t$95$1, If[LessEqual[y$46$im, 6.6e-163], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.8e+87], t$95$1, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_1 := t_0 - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\
t_2 := t_0 - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -6.8 \cdot 10^{+105}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-113}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y.im \leq 6.6 \cdot 10^{-163}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\

\mathbf{elif}\;y.im \leq 4.8 \cdot 10^{+87}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -6.7999999999999999e105 or 4.79999999999999963e87 < y.im

    1. Initial program 38.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub38.3%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg38.3%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt38.3%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow238.3%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def38.3%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*44.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt44.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow244.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def44.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr44.4%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg44.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*43.8%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/41.0%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified41.0%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. div-inv40.9%

        \[\leadsto \color{blue}{x.im \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. clear-num40.9%

        \[\leadsto x.im \cdot \color{blue}{\frac{y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      3. div-inv40.9%

        \[\leadsto x.im \cdot \color{blue}{\left(y.re \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      4. associate-*l*41.5%

        \[\leadsto \color{blue}{\left(x.im \cdot y.re\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      5. *-commutative41.5%

        \[\leadsto \color{blue}{\left(y.re \cdot x.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      6. div-inv41.5%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      7. unpow241.5%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      8. times-frac54.4%

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    8. Applied egg-rr54.4%

      \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    9. Taylor expanded in y.re around 0 88.5%

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

    if -6.7999999999999999e105 < y.im < -2.90000000000000004e-113 or 6.60000000000000002e-163 < y.im < 4.79999999999999963e87

    1. Initial program 71.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub71.5%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg71.5%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt71.4%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow271.4%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def71.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*72.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt72.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow272.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def72.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr72.4%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg72.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*75.0%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/72.4%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified72.4%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. div-inv72.2%

        \[\leadsto \color{blue}{x.im \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. clear-num72.2%

        \[\leadsto x.im \cdot \color{blue}{\frac{y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      3. div-inv72.3%

        \[\leadsto x.im \cdot \color{blue}{\left(y.re \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      4. associate-*l*69.7%

        \[\leadsto \color{blue}{\left(x.im \cdot y.re\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      5. *-commutative69.7%

        \[\leadsto \color{blue}{\left(y.re \cdot x.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      6. div-inv69.8%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      7. unpow269.8%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      8. times-frac91.7%

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    8. Applied egg-rr91.7%

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

    if -2.90000000000000004e-113 < y.im < 6.60000000000000002e-163

    1. Initial program 65.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 73.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative73.5%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg73.5%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg73.5%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*74.2%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified74.2%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow274.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv74.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*87.1%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr87.1%

      \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -6.8 \cdot 10^{+105}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-113}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\ \mathbf{elif}\;y.im \leq 6.6 \cdot 10^{-163}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 4.8 \cdot 10^{+87}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 83.3% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ t_1 := {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}\\ \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq -9.8 \cdot 10^{-104}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{-70}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 1.6 \cdot 10^{+87}:\\ \;\;\;\;\frac{x.im}{\frac{t_1}{y.re}} - y.im \cdot \frac{x.re}{t_1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (-
          (* (/ y.re (hypot y.re y.im)) (/ x.im (hypot y.re y.im)))
          (/ x.re y.im)))
        (t_1 (pow (hypot y.re y.im) 2.0)))
   (if (<= y.im -4.8e+91)
     t_0
     (if (<= y.im -9.8e-104)
       (-
        (/ x.im y.re)
        (* y.im (/ (/ x.re (hypot y.re y.im)) (hypot y.re y.im))))
       (if (<= y.im 9e-70)
         (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))
         (if (<= y.im 1.6e+87)
           (- (/ x.im (/ t_1 y.re)) (* y.im (/ x.re t_1)))
           t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im);
	double t_1 = pow(hypot(y_46_re, y_46_im), 2.0);
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = t_0;
	} else if (y_46_im <= -9.8e-104) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im)));
	} else if (y_46_im <= 9e-70) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 1.6e+87) {
		tmp = (x_46_im / (t_1 / y_46_re)) - (y_46_im * (x_46_re / t_1));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((y_46_re / Math.hypot(y_46_re, y_46_im)) * (x_46_im / Math.hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im);
	double t_1 = Math.pow(Math.hypot(y_46_re, y_46_im), 2.0);
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = t_0;
	} else if (y_46_im <= -9.8e-104) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / Math.hypot(y_46_re, y_46_im)) / Math.hypot(y_46_re, y_46_im)));
	} else if (y_46_im <= 9e-70) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 1.6e+87) {
		tmp = (x_46_im / (t_1 / y_46_re)) - (y_46_im * (x_46_re / t_1));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = ((y_46_re / math.hypot(y_46_re, y_46_im)) * (x_46_im / math.hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im)
	t_1 = math.pow(math.hypot(y_46_re, y_46_im), 2.0)
	tmp = 0
	if y_46_im <= -4.8e+91:
		tmp = t_0
	elif y_46_im <= -9.8e-104:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / math.hypot(y_46_re, y_46_im)) / math.hypot(y_46_re, y_46_im)))
	elif y_46_im <= 9e-70:
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	elif y_46_im <= 1.6e+87:
		tmp = (x_46_im / (t_1 / y_46_re)) - (y_46_im * (x_46_re / t_1))
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(Float64(y_46_re / hypot(y_46_re, y_46_im)) * Float64(x_46_im / hypot(y_46_re, y_46_im))) - Float64(x_46_re / y_46_im))
	t_1 = hypot(y_46_re, y_46_im) ^ 2.0
	tmp = 0.0
	if (y_46_im <= -4.8e+91)
		tmp = t_0;
	elseif (y_46_im <= -9.8e-104)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im))));
	elseif (y_46_im <= 9e-70)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	elseif (y_46_im <= 1.6e+87)
		tmp = Float64(Float64(x_46_im / Float64(t_1 / y_46_re)) - Float64(y_46_im * Float64(x_46_re / t_1)));
	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 = ((y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im);
	t_1 = hypot(y_46_re, y_46_im) ^ 2.0;
	tmp = 0.0;
	if (y_46_im <= -4.8e+91)
		tmp = t_0;
	elseif (y_46_im <= -9.8e-104)
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im)));
	elseif (y_46_im <= 9e-70)
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	elseif (y_46_im <= 1.6e+87)
		tmp = (x_46_im / (t_1 / y_46_re)) - (y_46_im * (x_46_re / t_1));
	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[(N[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[y$46$im, -4.8e+91], t$95$0, If[LessEqual[y$46$im, -9.8e-104], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 9e-70], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.6e+87], N[(N[(x$46$im / N[(t$95$1 / y$46$re), $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[(x$46$re / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\
t_1 := {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}\\
\mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y.im \leq -9.8 \cdot 10^{-104}:\\
\;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\

\mathbf{elif}\;y.im \leq 9 \cdot 10^{-70}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\

\mathbf{elif}\;y.im \leq 1.6 \cdot 10^{+87}:\\
\;\;\;\;\frac{x.im}{\frac{t_1}{y.re}} - y.im \cdot \frac{x.re}{t_1}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -4.79999999999999966e91 or 1.6e87 < y.im

    1. Initial program 39.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub39.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg39.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt39.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow239.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def39.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*45.6%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt45.6%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow245.6%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def45.6%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr45.6%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg45.6%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*45.1%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/42.3%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified42.3%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. div-inv42.3%

        \[\leadsto \color{blue}{x.im \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. clear-num42.3%

        \[\leadsto x.im \cdot \color{blue}{\frac{y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      3. div-inv42.3%

        \[\leadsto x.im \cdot \color{blue}{\left(y.re \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      4. associate-*l*42.8%

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

        \[\leadsto \color{blue}{\left(y.re \cdot x.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      6. div-inv42.8%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      7. unpow242.8%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      8. times-frac55.2%

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    8. Applied egg-rr55.2%

      \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    9. Taylor expanded in y.re around 0 88.0%

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

    if -4.79999999999999966e91 < y.im < -9.8000000000000006e-104

    1. Initial program 73.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub73.3%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg73.3%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt73.3%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow273.3%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def73.3%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*76.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt76.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow276.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def76.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr76.2%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg76.2%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*77.0%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/74.3%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified74.3%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. *-un-lft-identity74.3%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{\color{blue}{1 \cdot x.re}}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. unpow274.3%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{1 \cdot x.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
      3. times-frac74.3%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} \cdot y.im \]
    8. Applied egg-rr74.3%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} \cdot y.im \]
    9. Step-by-step derivation
      1. associate-*l/74.4%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{1 \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
      2. *-lft-identity74.4%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{\color{blue}{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.im \]
    10. Simplified74.4%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
    11. Taylor expanded in y.re around inf 83.7%

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

    if -9.8000000000000006e-104 < y.im < 9.00000000000000044e-70

    1. Initial program 64.0%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 75.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative75.8%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg75.8%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg75.8%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*76.2%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified76.2%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow276.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv76.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*84.8%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr84.8%

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

    if 9.00000000000000044e-70 < y.im < 1.6e87

    1. Initial program 75.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub75.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg75.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt75.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow275.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def75.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*75.9%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt75.9%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow275.9%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def75.9%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr75.9%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg75.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*78.9%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/78.8%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified78.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -9.8 \cdot 10^{-104}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{-70}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 1.6 \cdot 10^{+87}:\\ \;\;\;\;\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - y.im \cdot \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 82.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_1 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq -1.9 \cdot 10^{-103}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-95}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 1.45 \cdot 10^{+48}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (-
          (/ x.im y.re)
          (* y.im (/ (/ x.re (hypot y.re y.im)) (hypot y.re y.im)))))
        (t_1
         (-
          (* (/ y.re (hypot y.re y.im)) (/ x.im (hypot y.re y.im)))
          (/ x.re y.im))))
   (if (<= y.im -4.8e+91)
     t_1
     (if (<= y.im -1.9e-103)
       t_0
       (if (<= y.im 4.5e-95)
         (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))
         (if (<= y.im 1.45e+48) t_0 t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im)));
	double t_1 = ((y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = t_1;
	} else if (y_46_im <= -1.9e-103) {
		tmp = t_0;
	} else if (y_46_im <= 4.5e-95) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 1.45e+48) {
		tmp = t_0;
	} 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 = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / Math.hypot(y_46_re, y_46_im)) / Math.hypot(y_46_re, y_46_im)));
	double t_1 = ((y_46_re / Math.hypot(y_46_re, y_46_im)) * (x_46_im / Math.hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = t_1;
	} else if (y_46_im <= -1.9e-103) {
		tmp = t_0;
	} else if (y_46_im <= 4.5e-95) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 1.45e+48) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / math.hypot(y_46_re, y_46_im)) / math.hypot(y_46_re, y_46_im)))
	t_1 = ((y_46_re / math.hypot(y_46_re, y_46_im)) * (x_46_im / math.hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im)
	tmp = 0
	if y_46_im <= -4.8e+91:
		tmp = t_1
	elif y_46_im <= -1.9e-103:
		tmp = t_0
	elif y_46_im <= 4.5e-95:
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	elif y_46_im <= 1.45e+48:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im))))
	t_1 = Float64(Float64(Float64(y_46_re / hypot(y_46_re, y_46_im)) * Float64(x_46_im / hypot(y_46_re, y_46_im))) - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -4.8e+91)
		tmp = t_1;
	elseif (y_46_im <= -1.9e-103)
		tmp = t_0;
	elseif (y_46_im <= 4.5e-95)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	elseif (y_46_im <= 1.45e+48)
		tmp = t_0;
	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 = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / hypot(y_46_re, y_46_im)) / hypot(y_46_re, y_46_im)));
	t_1 = ((y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im);
	tmp = 0.0;
	if (y_46_im <= -4.8e+91)
		tmp = t_1;
	elseif (y_46_im <= -1.9e-103)
		tmp = t_0;
	elseif (y_46_im <= 4.5e-95)
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	elseif (y_46_im <= 1.45e+48)
		tmp = t_0;
	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[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -4.8e+91], t$95$1, If[LessEqual[y$46$im, -1.9e-103], t$95$0, If[LessEqual[y$46$im, 4.5e-95], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.45e+48], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_1 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y.im \leq -1.9 \cdot 10^{-103}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-95}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\

\mathbf{elif}\;y.im \leq 1.45 \cdot 10^{+48}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -4.79999999999999966e91 or 1.4499999999999999e48 < y.im

    1. Initial program 41.6%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub41.6%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg41.6%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt41.6%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow241.6%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def41.6%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*47.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt47.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow247.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def47.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr47.2%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg47.2%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*46.7%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/44.1%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified44.1%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. div-inv44.1%

        \[\leadsto \color{blue}{x.im \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. clear-num44.1%

        \[\leadsto x.im \cdot \color{blue}{\frac{y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      3. div-inv44.1%

        \[\leadsto x.im \cdot \color{blue}{\left(y.re \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      4. associate-*l*44.6%

        \[\leadsto \color{blue}{\left(x.im \cdot y.re\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      5. *-commutative44.6%

        \[\leadsto \color{blue}{\left(y.re \cdot x.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      6. div-inv44.5%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      7. unpow244.5%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      8. times-frac57.3%

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    8. Applied egg-rr57.3%

      \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    9. Taylor expanded in y.re around 0 87.7%

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

    if -4.79999999999999966e91 < y.im < -1.9e-103 or 4.5e-95 < y.im < 1.4499999999999999e48

    1. Initial program 71.9%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub71.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg71.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt71.9%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow271.9%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def71.9%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*73.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt73.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow273.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def73.2%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr73.2%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg73.2%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*76.5%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/75.2%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified75.2%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. *-un-lft-identity75.2%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{\color{blue}{1 \cdot x.re}}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. unpow275.2%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{1 \cdot x.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
      3. times-frac77.8%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} \cdot y.im \]
    8. Applied egg-rr77.8%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} \cdot y.im \]
    9. Step-by-step derivation
      1. associate-*l/78.0%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{1 \cdot \frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
      2. *-lft-identity78.0%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{\color{blue}{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.im \]
    10. Simplified78.0%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot y.im \]
    11. Taylor expanded in y.re around inf 80.0%

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

    if -1.9e-103 < y.im < 4.5e-95

    1. Initial program 65.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 75.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative75.4%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg75.4%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg75.4%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*75.8%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified75.8%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow275.8%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv75.8%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*85.0%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr85.0%

      \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.9 \cdot 10^{-103}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-95}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 1.45 \cdot 10^{+48}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -1.65 \cdot 10^{-31}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 5.6 \cdot 10^{-72}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 3.8 \cdot 10^{+14}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (-
          (* (/ y.re (hypot y.re y.im)) (/ x.im (hypot y.re y.im)))
          (/ x.re y.im))))
   (if (<= y.im -1.65e-31)
     t_0
     (if (<= y.im 5.6e-72)
       (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))
       (if (<= y.im 3.8e+14)
         (/ (fma x.im y.re (* y.im (- x.re))) (fma y.re y.re (* y.im y.im)))
         t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((y_46_re / hypot(y_46_re, y_46_im)) * (x_46_im / hypot(y_46_re, y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -1.65e-31) {
		tmp = t_0;
	} else if (y_46_im <= 5.6e-72) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 3.8e+14) {
		tmp = fma(x_46_im, y_46_re, (y_46_im * -x_46_re)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(Float64(y_46_re / hypot(y_46_re, y_46_im)) * Float64(x_46_im / hypot(y_46_re, y_46_im))) - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -1.65e-31)
		tmp = t_0;
	elseif (y_46_im <= 5.6e-72)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	elseif (y_46_im <= 3.8e+14)
		tmp = Float64(fma(x_46_im, y_46_re, Float64(y_46_im * Float64(-x_46_re))) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im)));
	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[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.65e-31], t$95$0, If[LessEqual[y$46$im, 5.6e-72], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 3.8e+14], N[(N[(x$46$im * y$46$re + N[(y$46$im * (-x$46$re)), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.65 \cdot 10^{-31}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y.im \leq 5.6 \cdot 10^{-72}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\

\mathbf{elif}\;y.im \leq 3.8 \cdot 10^{+14}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.65e-31 or 3.8e14 < y.im

    1. Initial program 45.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub45.1%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg45.1%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt45.1%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow245.1%

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

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*50.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt50.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow250.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def50.4%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr50.4%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg50.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*50.2%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/47.4%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified47.4%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Step-by-step derivation
      1. div-inv47.4%

        \[\leadsto \color{blue}{x.im \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      2. clear-num47.4%

        \[\leadsto x.im \cdot \color{blue}{\frac{y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      3. div-inv47.4%

        \[\leadsto x.im \cdot \color{blue}{\left(y.re \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      4. associate-*l*47.5%

        \[\leadsto \color{blue}{\left(x.im \cdot y.re\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      5. *-commutative47.5%

        \[\leadsto \color{blue}{\left(y.re \cdot x.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      6. div-inv47.5%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      7. unpow247.5%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
      8. times-frac63.8%

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    8. Applied egg-rr63.8%

      \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im \]
    9. Taylor expanded in y.re around 0 82.1%

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

    if -1.65e-31 < y.im < 5.5999999999999996e-72

    1. Initial program 66.4%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 75.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative75.3%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg75.3%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg75.3%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*74.7%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified74.7%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow274.7%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv74.7%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*82.0%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr82.0%

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

    if 5.5999999999999996e-72 < y.im < 3.8e14

    1. Initial program 83.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. fma-neg83.5%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x.im, y.re, -x.re \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. distribute-lft-neg-out83.5%

        \[\leadsto \frac{\mathsf{fma}\left(x.im, y.re, \color{blue}{\left(-x.re\right) \cdot y.im}\right)}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. *-commutative83.5%

        \[\leadsto \frac{\mathsf{fma}\left(x.im, y.re, \color{blue}{y.im \cdot \left(-x.re\right)}\right)}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. fma-def83.5%

        \[\leadsto \frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}} \]
    4. Add Preprocessing
  3. Recombined 3 regimes into one program.
  4. Final simplification82.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.65 \cdot 10^{-31}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 5.6 \cdot 10^{-72}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 3.8 \cdot 10^{+14}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 75.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 10^{-71}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 2 \cdot 10^{+45}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -4.8e+91)
   (- (/ y.re (/ (pow y.im 2.0) x.im)) (/ x.re y.im))
   (if (<= y.im 1e-71)
     (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))
     (if (<= y.im 2e+45)
       (/ (fma x.im y.re (* y.im (- x.re))) (fma y.re y.re (* y.im y.im)))
       (- (/ x.im (* y.im (/ y.im y.re))) (/ x.re y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = (y_46_re / (pow(y_46_im, 2.0) / x_46_im)) - (x_46_re / y_46_im);
	} else if (y_46_im <= 1e-71) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 2e+45) {
		tmp = fma(x_46_im, y_46_re, (y_46_im * -x_46_re)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
	} else {
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -4.8e+91)
		tmp = Float64(Float64(y_46_re / Float64((y_46_im ^ 2.0) / x_46_im)) - Float64(x_46_re / y_46_im));
	elseif (y_46_im <= 1e-71)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	elseif (y_46_im <= 2e+45)
		tmp = Float64(fma(x_46_im, y_46_re, Float64(y_46_im * Float64(-x_46_re))) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im)));
	else
		tmp = Float64(Float64(x_46_im / Float64(y_46_im * Float64(y_46_im / y_46_re))) - Float64(x_46_re / y_46_im));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -4.8e+91], N[(N[(y$46$re / N[(N[Power[y$46$im, 2.0], $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1e-71], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2e+45], N[(N[(x$46$im * y$46$re + N[(y$46$im * (-x$46$re)), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im / N[(y$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\
\;\;\;\;\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}\\

\mathbf{elif}\;y.im \leq 10^{-71}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\

\mathbf{elif}\;y.im \leq 2 \cdot 10^{+45}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -4.79999999999999966e91

    1. Initial program 42.9%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around 0 74.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    4. Step-by-step derivation
      1. +-commutative74.7%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-neg74.7%

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]
      3. unsub-neg74.7%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. *-commutative74.7%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      5. associate-/l*76.8%

        \[\leadsto \color{blue}{\frac{y.re}{\frac{{y.im}^{2}}{x.im}}} - \frac{x.re}{y.im} \]
    5. Simplified76.8%

      \[\leadsto \color{blue}{\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}} \]

    if -4.79999999999999966e91 < y.im < 9.9999999999999992e-72

    1. Initial program 66.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 72.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative72.7%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg72.7%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg72.7%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*72.1%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified72.1%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow272.1%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv72.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*78.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr78.2%

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

    if 9.9999999999999992e-72 < y.im < 1.9999999999999999e45

    1. Initial program 76.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. fma-neg76.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x.im, y.re, -x.re \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. distribute-lft-neg-out76.8%

        \[\leadsto \frac{\mathsf{fma}\left(x.im, y.re, \color{blue}{\left(-x.re\right) \cdot y.im}\right)}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. *-commutative76.8%

        \[\leadsto \frac{\mathsf{fma}\left(x.im, y.re, \color{blue}{y.im \cdot \left(-x.re\right)}\right)}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. fma-def76.8%

        \[\leadsto \frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}} \]
    3. Simplified76.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}} \]
    4. Add Preprocessing

    if 1.9999999999999999e45 < y.im

    1. Initial program 40.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub40.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg40.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt40.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow240.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def40.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*43.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt43.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow243.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def43.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr43.7%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg43.7%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*44.3%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/41.0%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified41.0%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Taylor expanded in y.re around 0 76.6%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{y.im}} \]
    8. Taylor expanded in y.re around 0 76.6%

      \[\leadsto \frac{x.im}{\frac{\color{blue}{{y.im}^{2}}}{y.re}} - \frac{x.re}{y.im} \]
    9. Step-by-step derivation
      1. pow276.6%

        \[\leadsto \frac{x.im}{\frac{\color{blue}{y.im \cdot y.im}}{y.re}} - \frac{x.re}{y.im} \]
      2. *-un-lft-identity76.6%

        \[\leadsto \frac{x.im}{\frac{y.im \cdot y.im}{\color{blue}{1 \cdot y.re}}} - \frac{x.re}{y.im} \]
      3. times-frac78.4%

        \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]
    10. Applied egg-rr78.4%

      \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 10^{-71}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 2 \cdot 10^{+45}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, y.re, y.im \cdot \left(-x.re\right)\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 75.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 2.02 \cdot 10^{-72}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 1.16 \cdot 10^{+45}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -4.8e+91)
   (- (/ y.re (/ (pow y.im 2.0) x.im)) (/ x.re y.im))
   (if (<= y.im 2.02e-72)
     (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))
     (if (<= y.im 1.16e+45)
       (/ (- (* x.im y.re) (* y.im x.re)) (+ (* y.im y.im) (* y.re y.re)))
       (- (/ x.im (* y.im (/ y.im y.re))) (/ x.re y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = (y_46_re / (pow(y_46_im, 2.0) / x_46_im)) - (x_46_re / y_46_im);
	} else if (y_46_im <= 2.02e-72) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 1.16e+45) {
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	} else {
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if (y_46im <= (-4.8d+91)) then
        tmp = (y_46re / ((y_46im ** 2.0d0) / x_46im)) - (x_46re / y_46im)
    else if (y_46im <= 2.02d-72) then
        tmp = (x_46im / y_46re) - (x_46re / (y_46re * (y_46re * (1.0d0 / y_46im))))
    else if (y_46im <= 1.16d+45) then
        tmp = ((x_46im * y_46re) - (y_46im * x_46re)) / ((y_46im * y_46im) + (y_46re * y_46re))
    else
        tmp = (x_46im / (y_46im * (y_46im / y_46re))) - (x_46re / y_46im)
    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 tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = (y_46_re / (Math.pow(y_46_im, 2.0) / x_46_im)) - (x_46_re / y_46_im);
	} else if (y_46_im <= 2.02e-72) {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	} else if (y_46_im <= 1.16e+45) {
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	} else {
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_im <= -4.8e+91:
		tmp = (y_46_re / (math.pow(y_46_im, 2.0) / x_46_im)) - (x_46_re / y_46_im)
	elif y_46_im <= 2.02e-72:
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	elif y_46_im <= 1.16e+45:
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re))
	else:
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -4.8e+91)
		tmp = Float64(Float64(y_46_re / Float64((y_46_im ^ 2.0) / x_46_im)) - Float64(x_46_re / y_46_im));
	elseif (y_46_im <= 2.02e-72)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	elseif (y_46_im <= 1.16e+45)
		tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re)));
	else
		tmp = Float64(Float64(x_46_im / Float64(y_46_im * Float64(y_46_im / y_46_re))) - Float64(x_46_re / y_46_im));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_im <= -4.8e+91)
		tmp = (y_46_re / ((y_46_im ^ 2.0) / x_46_im)) - (x_46_re / y_46_im);
	elseif (y_46_im <= 2.02e-72)
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	elseif (y_46_im <= 1.16e+45)
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	else
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -4.8e+91], N[(N[(y$46$re / N[(N[Power[y$46$im, 2.0], $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.02e-72], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.16e+45], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im / N[(y$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\
\;\;\;\;\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}\\

\mathbf{elif}\;y.im \leq 2.02 \cdot 10^{-72}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\

\mathbf{elif}\;y.im \leq 1.16 \cdot 10^{+45}:\\
\;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\

\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -4.79999999999999966e91

    1. Initial program 42.9%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around 0 74.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    4. Step-by-step derivation
      1. +-commutative74.7%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-neg74.7%

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]
      3. unsub-neg74.7%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. *-commutative74.7%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      5. associate-/l*76.8%

        \[\leadsto \color{blue}{\frac{y.re}{\frac{{y.im}^{2}}{x.im}}} - \frac{x.re}{y.im} \]
    5. Simplified76.8%

      \[\leadsto \color{blue}{\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}} \]

    if -4.79999999999999966e91 < y.im < 2.02e-72

    1. Initial program 66.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 72.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative72.7%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg72.7%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg72.7%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*72.1%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified72.1%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow272.1%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv72.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*78.2%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr78.2%

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

    if 2.02e-72 < y.im < 1.1600000000000001e45

    1. Initial program 76.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing

    if 1.1600000000000001e45 < y.im

    1. Initial program 40.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub40.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg40.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt40.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow240.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def40.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*43.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt43.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow243.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def43.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr43.7%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg43.7%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*44.3%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/41.0%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified41.0%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Taylor expanded in y.re around 0 76.6%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{y.im}} \]
    8. Taylor expanded in y.re around 0 76.6%

      \[\leadsto \frac{x.im}{\frac{\color{blue}{{y.im}^{2}}}{y.re}} - \frac{x.re}{y.im} \]
    9. Step-by-step derivation
      1. pow276.6%

        \[\leadsto \frac{x.im}{\frac{\color{blue}{y.im \cdot y.im}}{y.re}} - \frac{x.re}{y.im} \]
      2. *-un-lft-identity76.6%

        \[\leadsto \frac{x.im}{\frac{y.im \cdot y.im}{\color{blue}{1 \cdot y.re}}} - \frac{x.re}{y.im} \]
      3. times-frac78.4%

        \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]
    10. Applied egg-rr78.4%

      \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;\frac{y.re}{\frac{{y.im}^{2}}{x.im}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 2.02 \cdot 10^{-72}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.im \leq 1.16 \cdot 10^{+45}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 77.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{if}\;y.re \leq -9 \cdot 10^{+88}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.re \leq 4.7 \cdot 10^{-157}:\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 5.2 \cdot 10^{+126}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))))
   (if (<= y.re -9e+88)
     t_0
     (if (<= y.re 4.7e-157)
       (- (/ x.im (* y.im (/ y.im y.re))) (/ x.re y.im))
       (if (<= y.re 5.2e+126)
         (/ (- (* x.im y.re) (* y.im x.re)) (+ (* y.im y.im) (* y.re y.re)))
         t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	double tmp;
	if (y_46_re <= -9e+88) {
		tmp = t_0;
	} else if (y_46_re <= 4.7e-157) {
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	} else if (y_46_re <= 5.2e+126) {
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x_46im / y_46re) - (x_46re / (y_46re * (y_46re * (1.0d0 / y_46im))))
    if (y_46re <= (-9d+88)) then
        tmp = t_0
    else if (y_46re <= 4.7d-157) then
        tmp = (x_46im / (y_46im * (y_46im / y_46re))) - (x_46re / y_46im)
    else if (y_46re <= 5.2d+126) then
        tmp = ((x_46im * y_46re) - (y_46im * x_46re)) / ((y_46im * y_46im) + (y_46re * y_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 = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	double tmp;
	if (y_46_re <= -9e+88) {
		tmp = t_0;
	} else if (y_46_re <= 4.7e-157) {
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	} else if (y_46_re <= 5.2e+126) {
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	tmp = 0
	if y_46_re <= -9e+88:
		tmp = t_0
	elif y_46_re <= 4.7e-157:
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im)
	elif y_46_re <= 5.2e+126:
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_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(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))))
	tmp = 0.0
	if (y_46_re <= -9e+88)
		tmp = t_0;
	elseif (y_46_re <= 4.7e-157)
		tmp = Float64(Float64(x_46_im / Float64(y_46_im * Float64(y_46_im / y_46_re))) - Float64(x_46_re / y_46_im));
	elseif (y_46_re <= 5.2e+126)
		tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_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 = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	tmp = 0.0;
	if (y_46_re <= -9e+88)
		tmp = t_0;
	elseif (y_46_re <= 4.7e-157)
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	elseif (y_46_re <= 5.2e+126)
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_im * y_46_im) + (y_46_re * y_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[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -9e+88], t$95$0, If[LessEqual[y$46$re, 4.7e-157], N[(N[(x$46$im / N[(y$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 5.2e+126], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\
\mathbf{if}\;y.re \leq -9 \cdot 10^{+88}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y.re \leq 4.7 \cdot 10^{-157}:\\
\;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 5.2 \cdot 10^{+126}:\\
\;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -9e88 or 5.1999999999999999e126 < y.re

    1. Initial program 33.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 71.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative71.9%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg71.9%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg71.9%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*72.3%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified72.3%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow272.3%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv72.3%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*78.4%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr78.4%

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

    if -9e88 < y.re < 4.7000000000000002e-157

    1. Initial program 66.0%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub61.2%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg61.2%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt61.1%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow261.1%

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

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*67.0%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt67.0%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow267.0%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def67.0%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr67.0%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg67.0%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*67.2%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/62.9%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified62.9%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Taylor expanded in y.re around 0 78.2%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{y.im}} \]
    8. Taylor expanded in y.re around 0 73.9%

      \[\leadsto \frac{x.im}{\frac{\color{blue}{{y.im}^{2}}}{y.re}} - \frac{x.re}{y.im} \]
    9. Step-by-step derivation
      1. pow273.9%

        \[\leadsto \frac{x.im}{\frac{\color{blue}{y.im \cdot y.im}}{y.re}} - \frac{x.re}{y.im} \]
      2. *-un-lft-identity73.9%

        \[\leadsto \frac{x.im}{\frac{y.im \cdot y.im}{\color{blue}{1 \cdot y.re}}} - \frac{x.re}{y.im} \]
      3. times-frac78.4%

        \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]
    10. Applied egg-rr78.4%

      \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]

    if 4.7000000000000002e-157 < y.re < 5.1999999999999999e126

    1. Initial program 78.9%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
  3. Recombined 3 regimes into one program.
  4. Final simplification78.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -9 \cdot 10^{+88}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \mathbf{elif}\;y.re \leq 4.7 \cdot 10^{-157}:\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 5.2 \cdot 10^{+126}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 71.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -4.9 \cdot 10^{+92} \lor \neg \left(y.im \leq 1.2 \cdot 10^{+45}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.im -4.9e+92) (not (<= y.im 1.2e+45)))
   (/ (- x.re) y.im)
   (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -4.9e+92) || !(y_46_im <= 1.2e+45)) {
		tmp = -x_46_re / y_46_im;
	} else {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if ((y_46im <= (-4.9d+92)) .or. (.not. (y_46im <= 1.2d+45))) then
        tmp = -x_46re / y_46im
    else
        tmp = (x_46im / y_46re) - (x_46re / (y_46re * (y_46re * (1.0d0 / y_46im))))
    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 tmp;
	if ((y_46_im <= -4.9e+92) || !(y_46_im <= 1.2e+45)) {
		tmp = -x_46_re / y_46_im;
	} else {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (y_46_im <= -4.9e+92) or not (y_46_im <= 1.2e+45):
		tmp = -x_46_re / y_46_im
	else:
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((y_46_im <= -4.9e+92) || !(y_46_im <= 1.2e+45))
		tmp = Float64(Float64(-x_46_re) / y_46_im);
	else
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_im <= -4.9e+92) || ~((y_46_im <= 1.2e+45)))
		tmp = -x_46_re / y_46_im;
	else
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -4.9e+92], N[Not[LessEqual[y$46$im, 1.2e+45]], $MachinePrecision]], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -4.9 \cdot 10^{+92} \lor \neg \left(y.im \leq 1.2 \cdot 10^{+45}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -4.9000000000000002e92 or 1.19999999999999995e45 < y.im

    1. Initial program 41.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around 0 71.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
    4. Step-by-step derivation
      1. associate-*r/71.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot x.re}{y.im}} \]
      2. neg-mul-171.2%

        \[\leadsto \frac{\color{blue}{-x.re}}{y.im} \]
    5. Simplified71.2%

      \[\leadsto \color{blue}{\frac{-x.re}{y.im}} \]

    if -4.9000000000000002e92 < y.im < 1.19999999999999995e45

    1. Initial program 69.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 69.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative69.5%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg69.5%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg69.5%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*69.0%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified69.0%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow269.0%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv69.1%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*73.7%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr73.7%

      \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.9 \cdot 10^{+92} \lor \neg \left(y.im \leq 1.2 \cdot 10^{+45}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 73.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -7 \cdot 10^{+91} \lor \neg \left(y.im \leq 2.7 \cdot 10^{+42}\right):\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.im -7e+91) (not (<= y.im 2.7e+42)))
   (- (/ x.im (* y.im (/ y.im y.re))) (/ x.re y.im))
   (- (/ x.im y.re) (/ x.re (* y.re (* y.re (/ 1.0 y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -7e+91) || !(y_46_im <= 2.7e+42)) {
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	} else {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if ((y_46im <= (-7d+91)) .or. (.not. (y_46im <= 2.7d+42))) then
        tmp = (x_46im / (y_46im * (y_46im / y_46re))) - (x_46re / y_46im)
    else
        tmp = (x_46im / y_46re) - (x_46re / (y_46re * (y_46re * (1.0d0 / y_46im))))
    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 tmp;
	if ((y_46_im <= -7e+91) || !(y_46_im <= 2.7e+42)) {
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	} else {
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (y_46_im <= -7e+91) or not (y_46_im <= 2.7e+42):
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im)
	else:
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))))
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((y_46_im <= -7e+91) || !(y_46_im <= 2.7e+42))
		tmp = Float64(Float64(x_46_im / Float64(y_46_im * Float64(y_46_im / y_46_re))) - Float64(x_46_re / y_46_im));
	else
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re / Float64(y_46_re * Float64(y_46_re * Float64(1.0 / y_46_im)))));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_im <= -7e+91) || ~((y_46_im <= 2.7e+42)))
		tmp = (x_46_im / (y_46_im * (y_46_im / y_46_re))) - (x_46_re / y_46_im);
	else
		tmp = (x_46_im / y_46_re) - (x_46_re / (y_46_re * (y_46_re * (1.0 / y_46_im))));
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -7e+91], N[Not[LessEqual[y$46$im, 2.7e+42]], $MachinePrecision]], N[(N[(x$46$im / N[(y$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re / N[(y$46$re * N[(y$46$re * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7 \cdot 10^{+91} \lor \neg \left(y.im \leq 2.7 \cdot 10^{+42}\right):\\
\;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -7.00000000000000001e91 or 2.7000000000000001e42 < y.im

    1. Initial program 41.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub41.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. sub-neg41.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \]
      3. add-sqr-sqrt41.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      4. pow241.8%

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      5. hypot-def41.8%

        \[\leadsto \frac{x.im \cdot y.re}{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}} + \left(-\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      6. associate-/l*47.3%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      7. add-sqr-sqrt47.3%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{y.im}}\right) \]
      8. pow247.3%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}{y.im}}\right) \]
      9. hypot-def47.3%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}{y.im}}\right) \]
    4. Applied egg-rr47.3%

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} + \left(-\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)} \]
    5. Step-by-step derivation
      1. sub-neg47.3%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}} \]
      2. associate-/l*46.8%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}}} - \frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}} \]
      3. associate-/r/44.2%

        \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    6. Simplified44.2%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \frac{x.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \cdot y.im} \]
    7. Taylor expanded in y.re around 0 75.8%

      \[\leadsto \frac{x.im}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.re}} - \color{blue}{\frac{x.re}{y.im}} \]
    8. Taylor expanded in y.re around 0 75.8%

      \[\leadsto \frac{x.im}{\frac{\color{blue}{{y.im}^{2}}}{y.re}} - \frac{x.re}{y.im} \]
    9. Step-by-step derivation
      1. pow275.8%

        \[\leadsto \frac{x.im}{\frac{\color{blue}{y.im \cdot y.im}}{y.re}} - \frac{x.re}{y.im} \]
      2. *-un-lft-identity75.8%

        \[\leadsto \frac{x.im}{\frac{y.im \cdot y.im}{\color{blue}{1 \cdot y.re}}} - \frac{x.re}{y.im} \]
      3. times-frac76.8%

        \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]
    10. Applied egg-rr76.8%

      \[\leadsto \frac{x.im}{\color{blue}{\frac{y.im}{1} \cdot \frac{y.im}{y.re}}} - \frac{x.re}{y.im} \]

    if -7.00000000000000001e91 < y.im < 2.7000000000000001e42

    1. Initial program 69.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 69.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}} + \frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. +-commutative69.9%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg69.9%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg69.9%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*69.5%

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    5. Simplified69.5%

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
    6. Step-by-step derivation
      1. pow269.5%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\frac{\color{blue}{y.re \cdot y.re}}{y.im}} \]
      2. div-inv69.5%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{\left(y.re \cdot y.re\right) \cdot \frac{1}{y.im}}} \]
      3. associate-*l*74.1%

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
    7. Applied egg-rr74.1%

      \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -7 \cdot 10^{+91} \lor \neg \left(y.im \leq 2.7 \cdot 10^{+42}\right):\\ \;\;\;\;\frac{x.im}{y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot \left(y.re \cdot \frac{1}{y.im}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 65.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.65 \cdot 10^{+44} \lor \neg \left(y.im \leq 4.6 \cdot 10^{+43}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.im -1.65e+44) (not (<= y.im 4.6e+43)))
   (/ (- x.re) y.im)
   (/ x.im 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_im <= -1.65e+44) || !(y_46_im <= 4.6e+43)) {
		tmp = -x_46_re / y_46_im;
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if ((y_46im <= (-1.65d+44)) .or. (.not. (y_46im <= 4.6d+43))) then
        tmp = -x_46re / y_46im
    else
        tmp = x_46im / y_46re
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -1.65e+44) || !(y_46_im <= 4.6e+43)) {
		tmp = -x_46_re / y_46_im;
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (y_46_im <= -1.65e+44) or not (y_46_im <= 4.6e+43):
		tmp = -x_46_re / y_46_im
	else:
		tmp = x_46_im / 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_im <= -1.65e+44) || !(y_46_im <= 4.6e+43))
		tmp = Float64(Float64(-x_46_re) / y_46_im);
	else
		tmp = Float64(x_46_im / y_46_re);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_im <= -1.65e+44) || ~((y_46_im <= 4.6e+43)))
		tmp = -x_46_re / y_46_im;
	else
		tmp = x_46_im / y_46_re;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -1.65e+44], N[Not[LessEqual[y$46$im, 4.6e+43]], $MachinePrecision]], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.65 \cdot 10^{+44} \lor \neg \left(y.im \leq 4.6 \cdot 10^{+43}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\

\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -1.65000000000000007e44 or 4.6000000000000005e43 < y.im

    1. Initial program 44.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around 0 68.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
    4. Step-by-step derivation
      1. associate-*r/68.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot x.re}{y.im}} \]
      2. neg-mul-168.6%

        \[\leadsto \frac{\color{blue}{-x.re}}{y.im} \]
    5. Simplified68.6%

      \[\leadsto \color{blue}{\frac{-x.re}{y.im}} \]

    if -1.65000000000000007e44 < y.im < 4.6000000000000005e43

    1. Initial program 68.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf 62.9%

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.65 \cdot 10^{+44} \lor \neg \left(y.im \leq 4.6 \cdot 10^{+43}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 43.1% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \frac{x.im}{y.re} \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return x_46_im / y_46_re;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = x_46im / 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 x_46_im / y_46_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(x_46_im / y_46_re)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = x_46_im / y_46_re;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im}{y.re}
\end{array}
Derivation
  1. Initial program 57.3%

    \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
  2. Add Preprocessing
  3. Taylor expanded in y.re around inf 41.2%

    \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  4. Final simplification41.2%

    \[\leadsto \frac{x.im}{y.re} \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2024010 
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, imaginary part"
  :precision binary64
  (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))