_divideComplex, imaginary part

Percentage Accurate: 61.8% → 93.8%
Time: 17.0s
Alternatives: 16
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 16 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.8% 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: 93.8% accurate, 0.0× speedup?

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

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

\mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+28}:\\
\;\;\;\;t_1 \cdot \left(t_0 - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 - x.re\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -4.4999999999999998e145

    1. Initial program 34.4%

      \[\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. div-sub34.4%

        \[\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-neg34.4%

        \[\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. *-un-lft-identity34.4%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re\right)}}{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. add-sqr-sqrt34.4%

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re\right)}{\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) \]
      5. times-frac34.4%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re}{\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) \]
      6. fma-def34.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}, \frac{x.im \cdot y.re}{\sqrt{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}\right)} \]
      7. hypot-def34.4%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im \cdot y.re}{\sqrt{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}\right) \]
      8. hypot-def54.2%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im \cdot y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      9. associate-/l*58.3%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, -\color{blue}{\frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right) \]
      10. add-sqr-sqrt58.3%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im \cdot y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, -\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) \]
      11. pow258.3%

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

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

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

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

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

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

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

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

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

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

    if -4.4999999999999998e145 < y.im < 7.4999999999999998e28

    1. Initial program 76.4%

      \[\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. *-un-lft-identity76.4%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac76.4%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def76.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{\color{blue}{y.re \cdot x.im}}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right) \]
      3. associate-*r/95.1%

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

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

    if 7.4999999999999998e28 < y.im

    1. Initial program 46.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. *-un-lft-identity46.5%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac46.4%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def46.4%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def68.0%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.5 \cdot 10^{+145}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{y.re}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{x.im}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\ \end{array} \]

Alternative 2: 87.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_1 := y.re \cdot x.im - y.im \cdot x.re\\ \mathbf{if}\;\frac{t_1}{y.re \cdot y.re + y.im \cdot y.im} \leq \infty:\\ \;\;\;\;t_0 \cdot \frac{t_1}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ 1.0 (hypot y.re y.im))) (t_1 (- (* y.re x.im) (* y.im x.re))))
   (if (<= (/ t_1 (+ (* y.re y.re) (* y.im y.im))) INFINITY)
     (* t_0 (/ t_1 (hypot y.re y.im)))
     (* t_0 (- (* y.re (/ x.im (hypot y.re y.im))) x.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = 1.0 / hypot(y_46_re, y_46_im);
	double t_1 = (y_46_re * x_46_im) - (y_46_im * x_46_re);
	double tmp;
	if ((t_1 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= ((double) INFINITY)) {
		tmp = t_0 * (t_1 / hypot(y_46_re, y_46_im));
	} else {
		tmp = t_0 * ((y_46_re * (x_46_im / hypot(y_46_re, y_46_im))) - x_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = 1.0 / Math.hypot(y_46_re, y_46_im);
	double t_1 = (y_46_re * x_46_im) - (y_46_im * x_46_re);
	double tmp;
	if ((t_1 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= Double.POSITIVE_INFINITY) {
		tmp = t_0 * (t_1 / Math.hypot(y_46_re, y_46_im));
	} else {
		tmp = t_0 * ((y_46_re * (x_46_im / Math.hypot(y_46_re, y_46_im))) - x_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = 1.0 / math.hypot(y_46_re, y_46_im)
	t_1 = (y_46_re * x_46_im) - (y_46_im * x_46_re)
	tmp = 0
	if (t_1 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= math.inf:
		tmp = t_0 * (t_1 / math.hypot(y_46_re, y_46_im))
	else:
		tmp = t_0 * ((y_46_re * (x_46_im / math.hypot(y_46_re, y_46_im))) - x_46_re)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(1.0 / hypot(y_46_re, y_46_im))
	t_1 = Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re))
	tmp = 0.0
	if (Float64(t_1 / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) <= Inf)
		tmp = Float64(t_0 * Float64(t_1 / hypot(y_46_re, y_46_im)));
	else
		tmp = Float64(t_0 * Float64(Float64(y_46_re * Float64(x_46_im / hypot(y_46_re, y_46_im))) - x_46_re));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = 1.0 / hypot(y_46_re, y_46_im);
	t_1 = (y_46_re * x_46_im) - (y_46_im * x_46_re);
	tmp = 0.0;
	if ((t_1 / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= Inf)
		tmp = t_0 * (t_1 / hypot(y_46_re, y_46_im));
	else
		tmp = t_0 * ((y_46_re * (x_46_im / hypot(y_46_re, y_46_im))) - x_46_re);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(t$95$1 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(y$46$re * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < +inf.0

    1. Initial program 77.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. *-un-lft-identity77.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac77.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def77.7%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def94.7%

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

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

    if +inf.0 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im)))

    1. Initial program 0.0%

      \[\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. *-un-lft-identity0.0%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac0.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def0.0%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def2.6%

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{\color{blue}{y.re \cdot x.im}}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right) \]
      3. associate-*r/44.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im} \leq \infty:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\ \end{array} \]

Alternative 3: 87.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im} \leq \infty:\\ \;\;\;\;\frac{\frac{y.im \cdot x.re - y.re \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<=
      (/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
      INFINITY)
   (/
    (/ (- (* y.im x.re) (* y.re x.im)) (hypot y.re y.im))
    (- (hypot y.re y.im)))
   (* (/ 1.0 (hypot y.re y.im)) (- (* y.re (/ x.im (hypot y.re y.im))) x.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= ((double) INFINITY)) {
		tmp = (((y_46_im * x_46_re) - (y_46_re * x_46_im)) / hypot(y_46_re, y_46_im)) / -hypot(y_46_re, y_46_im);
	} else {
		tmp = (1.0 / hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / hypot(y_46_re, y_46_im))) - x_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= Double.POSITIVE_INFINITY) {
		tmp = (((y_46_im * x_46_re) - (y_46_re * x_46_im)) / Math.hypot(y_46_re, y_46_im)) / -Math.hypot(y_46_re, y_46_im);
	} else {
		tmp = (1.0 / Math.hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / Math.hypot(y_46_re, y_46_im))) - x_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= math.inf:
		tmp = (((y_46_im * x_46_re) - (y_46_re * x_46_im)) / math.hypot(y_46_re, y_46_im)) / -math.hypot(y_46_re, y_46_im)
	else:
		tmp = (1.0 / math.hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / math.hypot(y_46_re, y_46_im))) - x_46_re)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) <= Inf)
		tmp = Float64(Float64(Float64(Float64(y_46_im * x_46_re) - Float64(y_46_re * x_46_im)) / hypot(y_46_re, y_46_im)) / Float64(-hypot(y_46_re, y_46_im)));
	else
		tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(Float64(y_46_re * Float64(x_46_im / hypot(y_46_re, y_46_im))) - x_46_re));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= Inf)
		tmp = (((y_46_im * x_46_re) - (y_46_re * x_46_im)) / hypot(y_46_re, y_46_im)) / -hypot(y_46_re, y_46_im);
	else
		tmp = (1.0 / hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / hypot(y_46_re, y_46_im))) - x_46_re);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(y$46$im * x$46$re), $MachinePrecision] - N[(y$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision])), $MachinePrecision], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im} \leq \infty:\\
\;\;\;\;\frac{\frac{y.im \cdot x.re - y.re \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < +inf.0

    1. Initial program 77.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. *-un-lft-identity77.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac77.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def77.7%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def94.7%

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

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

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

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

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

        \[\leadsto \frac{-\frac{\color{blue}{\mathsf{fma}\left(x.im, y.re, -x.re \cdot y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)} \]
      5. distribute-rgt-neg-in94.8%

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

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)}} \]
    6. Step-by-step derivation
      1. distribute-neg-frac94.8%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\left(-x.re \cdot \left(-y.im\right)\right) + \left(-x.im \cdot y.re\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)} \]
      5. distribute-rgt-neg-out94.8%

        \[\leadsto \frac{\frac{\left(-\color{blue}{\left(-x.re \cdot y.im\right)}\right) + \left(-x.im \cdot y.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)} \]
      6. remove-double-neg94.8%

        \[\leadsto \frac{\frac{\color{blue}{x.re \cdot y.im} + \left(-x.im \cdot y.re\right)}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)} \]
      7. distribute-rgt-neg-in94.8%

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

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

    if +inf.0 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im)))

    1. Initial program 0.0%

      \[\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. *-un-lft-identity0.0%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac0.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def0.0%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def2.6%

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{\color{blue}{y.re \cdot x.im}}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right) \]
      3. associate-*r/44.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im} \leq \infty:\\ \;\;\;\;\frac{\frac{y.im \cdot x.re - y.re \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}}{-\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\ \end{array} \]

Alternative 4: 82.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y.re \cdot x.im - y.im \cdot x.re\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2}\\ t_1 := \frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{if}\;y.im \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq -4.3 \cdot 10^{-76}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 7.7 \cdot 10^{-106}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (* (- (* y.re x.im) (* y.im x.re)) (pow (hypot y.re y.im) -2.0)))
        (t_1 (* (/ 1.0 y.im) (- (* y.re (/ x.im y.im)) x.re))))
   (if (<= y.im -3.4e+143)
     t_1
     (if (<= y.im -4.3e-76)
       t_0
       (if (<= y.im 7.7e-106)
         (* (/ 1.0 y.re) (- x.im (/ (* y.im x.re) y.re)))
         (if (<= y.im 7.5e+28) 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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * pow(hypot(y_46_re, y_46_im), -2.0);
	double t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	double tmp;
	if (y_46_im <= -3.4e+143) {
		tmp = t_1;
	} else if (y_46_im <= -4.3e-76) {
		tmp = t_0;
	} else if (y_46_im <= 7.7e-106) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else if (y_46_im <= 7.5e+28) {
		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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * Math.pow(Math.hypot(y_46_re, y_46_im), -2.0);
	double t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	double tmp;
	if (y_46_im <= -3.4e+143) {
		tmp = t_1;
	} else if (y_46_im <= -4.3e-76) {
		tmp = t_0;
	} else if (y_46_im <= 7.7e-106) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else if (y_46_im <= 7.5e+28) {
		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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * math.pow(math.hypot(y_46_re, y_46_im), -2.0)
	t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re)
	tmp = 0
	if y_46_im <= -3.4e+143:
		tmp = t_1
	elif y_46_im <= -4.3e-76:
		tmp = t_0
	elif y_46_im <= 7.7e-106:
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re))
	elif y_46_im <= 7.5e+28:
		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(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) * (hypot(y_46_re, y_46_im) ^ -2.0))
	t_1 = Float64(Float64(1.0 / y_46_im) * Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re))
	tmp = 0.0
	if (y_46_im <= -3.4e+143)
		tmp = t_1;
	elseif (y_46_im <= -4.3e-76)
		tmp = t_0;
	elseif (y_46_im <= 7.7e-106)
		tmp = Float64(Float64(1.0 / y_46_re) * Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)));
	elseif (y_46_im <= 7.5e+28)
		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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * (hypot(y_46_re, y_46_im) ^ -2.0);
	t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	tmp = 0.0;
	if (y_46_im <= -3.4e+143)
		tmp = t_1;
	elseif (y_46_im <= -4.3e-76)
		tmp = t_0;
	elseif (y_46_im <= 7.7e-106)
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	elseif (y_46_im <= 7.5e+28)
		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[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.4e+143], t$95$1, If[LessEqual[y$46$im, -4.3e-76], t$95$0, If[LessEqual[y$46$im, 7.7e-106], N[(N[(1.0 / y$46$re), $MachinePrecision] * N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 7.5e+28], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -3.39999999999999982e143 or 7.4999999999999998e28 < y.im

    1. Initial program 44.0%

      \[\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. *-un-lft-identity44.0%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac44.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def44.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg66.7%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/92.6%

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

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

    if -3.39999999999999982e143 < y.im < -4.2999999999999999e-76 or 7.6999999999999996e-106 < y.im < 7.4999999999999998e28

    1. Initial program 83.1%

      \[\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. *-un-lft-identity83.1%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac82.9%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def82.9%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def88.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(x.im, y.re, -x.re \cdot y.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - 1 \]
      10. distribute-rgt-neg-in37.8%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(x.im, y.re, \color{blue}{x.re \cdot \left(-y.im\right)}\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - 1 \]
      11. pow-flip37.8%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right) \cdot \color{blue}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{\left(-2\right)}}\right)} - 1 \]
      12. metadata-eval37.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def66.5%

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

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

        \[\leadsto \color{blue}{\left(x.im \cdot y.re + x.re \cdot \left(-y.im\right)\right)} \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2} \]
      4. distribute-rgt-neg-out83.2%

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

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

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

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

    if -4.2999999999999999e-76 < y.im < 7.6999999999999996e-106

    1. Initial program 70.0%

      \[\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. *-un-lft-identity70.0%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac70.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def70.1%

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/51.7%

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im + \frac{\color{blue}{-x.re \cdot y.im}}{y.re}\right) \]
      3. distribute-rgt-neg-out51.7%

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + \frac{x.re \cdot \left(-y.im\right)}{y.re}\right)} \]
    7. Taylor expanded in y.re around inf 88.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq -4.3 \cdot 10^{-76}:\\ \;\;\;\;\left(y.re \cdot x.im - y.im \cdot x.re\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2}\\ \mathbf{elif}\;y.im \leq 7.7 \cdot 10^{-106}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;\left(y.re \cdot x.im - y.im \cdot x.re\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \end{array} \]

Alternative 5: 84.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq -3.9 \cdot 10^{-76}:\\ \;\;\;\;\left(y.re \cdot x.im - y.im \cdot x.re\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2}\\ \mathbf{elif}\;y.im \leq 5.8 \cdot 10^{-96}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -3.4e+143)
   (* (/ 1.0 y.im) (- (* y.re (/ x.im y.im)) x.re))
   (if (<= y.im -3.9e-76)
     (* (- (* y.re x.im) (* y.im x.re)) (pow (hypot y.re y.im) -2.0))
     (if (<= y.im 5.8e-96)
       (* (/ 1.0 y.re) (- x.im (/ (* y.im x.re) y.re)))
       (*
        (/ 1.0 (hypot y.re y.im))
        (- (* y.re (/ x.im (hypot y.re y.im))) x.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -3.4e+143) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= -3.9e-76) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * pow(hypot(y_46_re, y_46_im), -2.0);
	} else if (y_46_im <= 5.8e-96) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else {
		tmp = (1.0 / hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / hypot(y_46_re, y_46_im))) - x_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -3.4e+143) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= -3.9e-76) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * Math.pow(Math.hypot(y_46_re, y_46_im), -2.0);
	} else if (y_46_im <= 5.8e-96) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else {
		tmp = (1.0 / Math.hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / Math.hypot(y_46_re, y_46_im))) - x_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_im <= -3.4e+143:
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re)
	elif y_46_im <= -3.9e-76:
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * math.pow(math.hypot(y_46_re, y_46_im), -2.0)
	elif y_46_im <= 5.8e-96:
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re))
	else:
		tmp = (1.0 / math.hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / math.hypot(y_46_re, y_46_im))) - x_46_re)
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -3.4e+143)
		tmp = Float64(Float64(1.0 / y_46_im) * Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re));
	elseif (y_46_im <= -3.9e-76)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) * (hypot(y_46_re, y_46_im) ^ -2.0));
	elseif (y_46_im <= 5.8e-96)
		tmp = Float64(Float64(1.0 / y_46_re) * Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)));
	else
		tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(Float64(y_46_re * Float64(x_46_im / hypot(y_46_re, y_46_im))) - x_46_re));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_im <= -3.4e+143)
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	elseif (y_46_im <= -3.9e-76)
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) * (hypot(y_46_re, y_46_im) ^ -2.0);
	elseif (y_46_im <= 5.8e-96)
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	else
		tmp = (1.0 / hypot(y_46_re, y_46_im)) * ((y_46_re * (x_46_im / hypot(y_46_re, y_46_im))) - x_46_re);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -3.4e+143], N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -3.9e-76], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 5.8e-96], N[(N[(1.0 / y$46$re), $MachinePrecision] * N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

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

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


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

    1. Initial program 39.9%

      \[\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. *-un-lft-identity39.9%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac40.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def40.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/94.5%

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

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

    if -3.39999999999999982e143 < y.im < -3.90000000000000025e-76

    1. Initial program 82.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. *-un-lft-identity82.5%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac82.3%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def82.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(x.im, y.re, -x.re \cdot y.im\right)} \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - 1 \]
      10. distribute-rgt-neg-in39.1%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(x.im, y.re, \color{blue}{x.re \cdot \left(-y.im\right)}\right) \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} - 1 \]
      11. pow-flip39.1%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right) \cdot \color{blue}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{\left(-2\right)}}\right)} - 1 \]
      12. metadata-eval39.1%

        \[\leadsto e^{\mathsf{log1p}\left(\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{\color{blue}{-2}}\right)} - 1 \]
    5. Applied egg-rr39.1%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def70.6%

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

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

        \[\leadsto \color{blue}{\left(x.im \cdot y.re + x.re \cdot \left(-y.im\right)\right)} \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2} \]
      4. distribute-rgt-neg-out82.6%

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

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

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

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

    if -3.90000000000000025e-76 < y.im < 5.79999999999999987e-96

    1. Initial program 70.3%

      \[\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. *-un-lft-identity70.3%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac70.4%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def70.4%

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/51.2%

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im + \frac{\color{blue}{-x.re \cdot y.im}}{y.re}\right) \]
      3. distribute-rgt-neg-out51.2%

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + \frac{x.re \cdot \left(-y.im\right)}{y.re}\right)} \]
    7. Taylor expanded in y.re around inf 88.5%

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

    if 5.79999999999999987e-96 < y.im

    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. Step-by-step derivation
      1. *-un-lft-identity57.3%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac57.3%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def57.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{\color{blue}{y.re \cdot x.im}}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right) \]
      3. associate-*r/78.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq -3.9 \cdot 10^{-76}:\\ \;\;\;\;\left(y.re \cdot x.im - y.im \cdot x.re\right) \cdot {\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{-2}\\ \mathbf{elif}\;y.im \leq 5.8 \cdot 10^{-96}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - x.re\right)\\ \end{array} \]

Alternative 6: 82.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ t_1 := \frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{if}\;y.im \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq -4.3 \cdot 10^{-78}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 2.5 \cdot 10^{-106}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im))))
        (t_1 (* (/ 1.0 y.im) (- (* y.re (/ x.im y.im)) x.re))))
   (if (<= y.im -3.4e+143)
     t_1
     (if (<= y.im -4.3e-78)
       t_0
       (if (<= y.im 2.5e-106)
         (* (/ 1.0 y.re) (- x.im (/ (* y.im x.re) y.re)))
         (if (<= y.im 7.5e+28) 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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	double tmp;
	if (y_46_im <= -3.4e+143) {
		tmp = t_1;
	} else if (y_46_im <= -4.3e-78) {
		tmp = t_0;
	} else if (y_46_im <= 2.5e-106) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else if (y_46_im <= 7.5e+28) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
    t_1 = (1.0d0 / y_46im) * ((y_46re * (x_46im / y_46im)) - x_46re)
    if (y_46im <= (-3.4d+143)) then
        tmp = t_1
    else if (y_46im <= (-4.3d-78)) then
        tmp = t_0
    else if (y_46im <= 2.5d-106) then
        tmp = (1.0d0 / y_46re) * (x_46im - ((y_46im * x_46re) / y_46re))
    else if (y_46im <= 7.5d+28) then
        tmp = t_0
    else
        tmp = t_1
    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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	double tmp;
	if (y_46_im <= -3.4e+143) {
		tmp = t_1;
	} else if (y_46_im <= -4.3e-78) {
		tmp = t_0;
	} else if (y_46_im <= 2.5e-106) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else if (y_46_im <= 7.5e+28) {
		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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re)
	tmp = 0
	if y_46_im <= -3.4e+143:
		tmp = t_1
	elif y_46_im <= -4.3e-78:
		tmp = t_0
	elif y_46_im <= 2.5e-106:
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re))
	elif y_46_im <= 7.5e+28:
		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(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
	t_1 = Float64(Float64(1.0 / y_46_im) * Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re))
	tmp = 0.0
	if (y_46_im <= -3.4e+143)
		tmp = t_1;
	elseif (y_46_im <= -4.3e-78)
		tmp = t_0;
	elseif (y_46_im <= 2.5e-106)
		tmp = Float64(Float64(1.0 / y_46_re) * Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)));
	elseif (y_46_im <= 7.5e+28)
		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 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	t_1 = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	tmp = 0.0;
	if (y_46_im <= -3.4e+143)
		tmp = t_1;
	elseif (y_46_im <= -4.3e-78)
		tmp = t_0;
	elseif (y_46_im <= 2.5e-106)
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	elseif (y_46_im <= 7.5e+28)
		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[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -3.4e+143], t$95$1, If[LessEqual[y$46$im, -4.3e-78], t$95$0, If[LessEqual[y$46$im, 2.5e-106], N[(N[(1.0 / y$46$re), $MachinePrecision] * N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 7.5e+28], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -3.39999999999999982e143 or 7.4999999999999998e28 < y.im

    1. Initial program 44.0%

      \[\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. *-un-lft-identity44.0%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac44.0%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def44.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg66.7%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/92.6%

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

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

    if -3.39999999999999982e143 < y.im < -4.29999999999999994e-78 or 2.49999999999999991e-106 < y.im < 7.4999999999999998e28

    1. Initial program 83.1%

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

    if -4.29999999999999994e-78 < y.im < 2.49999999999999991e-106

    1. Initial program 70.0%

      \[\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. *-un-lft-identity70.0%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac70.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def70.1%

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

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/51.7%

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im + \frac{\color{blue}{-x.re \cdot y.im}}{y.re}\right) \]
      3. distribute-rgt-neg-out51.7%

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + \frac{x.re \cdot \left(-y.im\right)}{y.re}\right)} \]
    7. Taylor expanded in y.re around inf 88.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -3.4 \cdot 10^{+143}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq -4.3 \cdot 10^{-78}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 2.5 \cdot 10^{-106}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+28}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \end{array} \]

Alternative 7: 72.6% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.80000000000000009e-69

    1. Initial program 63.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. *-un-lft-identity63.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac63.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def63.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg20.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/76.6%

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

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

    if -1.80000000000000009e-69 < y.im < 1.5499999999999999e-72

    1. Initial program 71.7%

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/75.2%

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{x.re}{\color{blue}{y.re \cdot y.re}} \cdot y.im \]
    6. Applied egg-rr75.2%

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

    if 1.5499999999999999e-72 < y.im

    1. Initial program 55.8%

      \[\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. *-un-lft-identity55.8%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac55.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def55.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. expm1-log1p-u69.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)\right)} \]
      2. expm1-udef28.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)} - 1} \]
      3. associate-*l/28.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}} - x.re}}{y.im}\right)} - 1 \]
      5. div-inv28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{y.im}{y.re}}} - x.re}{y.im}\right)} - 1 \]
      6. clear-num28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x.im \cdot \color{blue}{\frac{y.re}{y.im}} - x.re}{y.im}\right)} - 1 \]
    9. Applied egg-rr28.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def69.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)\right)} \]
      2. expm1-log1p83.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}} \]
    11. Simplified83.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.8 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 1.55 \cdot 10^{-72}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{x.re}{y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \]

Alternative 8: 73.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.75 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 1.35 \cdot 10^{-68}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -1.75e-69)
   (* (/ 1.0 y.im) (- (* y.re (/ x.im y.im)) x.re))
   (if (<= y.im 1.35e-68)
     (- (/ x.im y.re) (* x.re (/ y.im (* y.re y.re))))
     (/ (- (* x.im (/ y.re y.im)) x.re) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -1.75e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 1.35e-68) {
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / (y_46_re * y_46_re)));
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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 <= (-1.75d-69)) then
        tmp = (1.0d0 / y_46im) * ((y_46re * (x_46im / y_46im)) - x_46re)
    else if (y_46im <= 1.35d-68) then
        tmp = (x_46im / y_46re) - (x_46re * (y_46im / (y_46re * y_46re)))
    else
        tmp = ((x_46im * (y_46re / y_46im)) - 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 <= -1.75e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 1.35e-68) {
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / (y_46_re * y_46_re)));
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_im <= -1.75e-69:
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re)
	elif y_46_im <= 1.35e-68:
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / (y_46_re * y_46_re)))
	else:
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -1.75e-69)
		tmp = Float64(Float64(1.0 / y_46_im) * Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re));
	elseif (y_46_im <= 1.35e-68)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re * Float64(y_46_im / Float64(y_46_re * y_46_re))));
	else
		tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_im <= -1.75e-69)
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	elseif (y_46_im <= 1.35e-68)
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / (y_46_re * y_46_re)));
	else
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.75e-69], N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.35e-68], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re * N[(y$46$im / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.7500000000000001e-69

    1. Initial program 63.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. *-un-lft-identity63.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac63.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def63.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg20.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/76.6%

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

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

    if -1.7500000000000001e-69 < y.im < 1.3500000000000001e-68

    1. Initial program 71.7%

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/75.2%

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{y.im}{\frac{{y.re}^{2}}{x.re}}} \]
    6. Applied egg-rr76.1%

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

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

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

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

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

    if 1.3500000000000001e-68 < y.im

    1. Initial program 55.8%

      \[\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. *-un-lft-identity55.8%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac55.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def55.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. expm1-log1p-u69.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)\right)} \]
      2. expm1-udef28.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)} - 1} \]
      3. associate-*l/28.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}} - x.re}}{y.im}\right)} - 1 \]
      5. div-inv28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{y.im}{y.re}}} - x.re}{y.im}\right)} - 1 \]
      6. clear-num28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x.im \cdot \color{blue}{\frac{y.re}{y.im}} - x.re}{y.im}\right)} - 1 \]
    9. Applied egg-rr28.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def69.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)\right)} \]
      2. expm1-log1p83.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}} \]
    11. Simplified83.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.75 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 1.35 \cdot 10^{-68}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \]

Alternative 9: 73.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.8 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 1.12 \cdot 10^{-69}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -1.8e-69)
   (* (/ 1.0 y.im) (- (* y.re (/ x.im y.im)) x.re))
   (if (<= y.im 1.12e-69)
     (- (/ x.im y.re) (* y.im (/ (/ x.re y.re) y.re)))
     (/ (- (* x.im (/ y.re y.im)) x.re) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -1.8e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 1.12e-69) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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 <= (-1.8d-69)) then
        tmp = (1.0d0 / y_46im) * ((y_46re * (x_46im / y_46im)) - x_46re)
    else if (y_46im <= 1.12d-69) then
        tmp = (x_46im / y_46re) - (y_46im * ((x_46re / y_46re) / y_46re))
    else
        tmp = ((x_46im * (y_46re / y_46im)) - 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 <= -1.8e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 1.12e-69) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_im <= -1.8e-69:
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re)
	elif y_46_im <= 1.12e-69:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re))
	else:
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -1.8e-69)
		tmp = Float64(Float64(1.0 / y_46_im) * Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re));
	elseif (y_46_im <= 1.12e-69)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / y_46_re) / y_46_re)));
	else
		tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_im <= -1.8e-69)
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	elseif (y_46_im <= 1.12e-69)
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	else
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.8e-69], N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.12e-69], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.80000000000000009e-69

    1. Initial program 63.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. *-un-lft-identity63.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac63.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def63.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg20.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/76.6%

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

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

    if -1.80000000000000009e-69 < y.im < 1.12e-69

    1. Initial program 71.7%

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/75.2%

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

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re}{{y.re}^{2}} \cdot y.im} \]
    5. Step-by-step derivation
      1. *-un-lft-identity75.2%

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

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

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

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\left(\frac{1}{y.re} \cdot \frac{x.re}{y.re}\right)} \cdot y.im \]
    7. Step-by-step derivation
      1. associate-*l/78.6%

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

        \[\leadsto \frac{x.im}{y.re} - \frac{\color{blue}{\frac{x.re}{y.re}}}{y.re} \cdot y.im \]
    8. Simplified78.6%

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

    if 1.12e-69 < y.im

    1. Initial program 55.8%

      \[\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. *-un-lft-identity55.8%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac55.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def55.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. expm1-log1p-u69.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)\right)} \]
      2. expm1-udef28.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)} - 1} \]
      3. associate-*l/28.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}} - x.re}}{y.im}\right)} - 1 \]
      5. div-inv28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{y.im}{y.re}}} - x.re}{y.im}\right)} - 1 \]
      6. clear-num28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x.im \cdot \color{blue}{\frac{y.re}{y.im}} - x.re}{y.im}\right)} - 1 \]
    9. Applied egg-rr28.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def69.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)\right)} \]
      2. expm1-log1p83.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}} \]
    11. Simplified83.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.8 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 1.12 \cdot 10^{-69}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \]

Alternative 10: 76.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.7 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 7.2 \cdot 10^{-71}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -1.7e-69)
   (* (/ 1.0 y.im) (- (* y.re (/ x.im y.im)) x.re))
   (if (<= y.im 7.2e-71)
     (* (/ 1.0 y.re) (- x.im (/ (* y.im x.re) y.re)))
     (/ (- (* x.im (/ y.re y.im)) x.re) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -1.7e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 7.2e-71) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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 <= (-1.7d-69)) then
        tmp = (1.0d0 / y_46im) * ((y_46re * (x_46im / y_46im)) - x_46re)
    else if (y_46im <= 7.2d-71) then
        tmp = (1.0d0 / y_46re) * (x_46im - ((y_46im * x_46re) / y_46re))
    else
        tmp = ((x_46im * (y_46re / y_46im)) - 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 <= -1.7e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 7.2e-71) {
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_im <= -1.7e-69:
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re)
	elif y_46_im <= 7.2e-71:
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re))
	else:
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -1.7e-69)
		tmp = Float64(Float64(1.0 / y_46_im) * Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re));
	elseif (y_46_im <= 7.2e-71)
		tmp = Float64(Float64(1.0 / y_46_re) * Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re)));
	else
		tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_im <= -1.7e-69)
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	elseif (y_46_im <= 7.2e-71)
		tmp = (1.0 / y_46_re) * (x_46_im - ((y_46_im * x_46_re) / y_46_re));
	else
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.7e-69], N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 7.2e-71], N[(N[(1.0 / y$46$re), $MachinePrecision] * N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.70000000000000004e-69

    1. Initial program 63.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. *-un-lft-identity63.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac63.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def63.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg20.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/76.6%

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

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

    if -1.70000000000000004e-69 < y.im < 7.2e-71

    1. Initial program 71.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. *-un-lft-identity71.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac71.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def71.8%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def81.7%

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/51.2%

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(x.im + \frac{\color{blue}{-x.re \cdot y.im}}{y.re}\right) \]
      3. distribute-rgt-neg-out51.2%

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(x.im + \frac{x.re \cdot \left(-y.im\right)}{y.re}\right)} \]
    7. Taylor expanded in y.re around inf 87.5%

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

    if 7.2e-71 < y.im

    1. Initial program 55.8%

      \[\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. *-un-lft-identity55.8%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac55.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def55.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. expm1-log1p-u69.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)\right)} \]
      2. expm1-udef28.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)} - 1} \]
      3. associate-*l/28.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}} - x.re}}{y.im}\right)} - 1 \]
      5. div-inv28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{y.im}{y.re}}} - x.re}{y.im}\right)} - 1 \]
      6. clear-num28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x.im \cdot \color{blue}{\frac{y.re}{y.im}} - x.re}{y.im}\right)} - 1 \]
    9. Applied egg-rr28.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def69.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)\right)} \]
      2. expm1-log1p83.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}} \]
    11. Simplified83.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.7 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 7.2 \cdot 10^{-71}:\\ \;\;\;\;\frac{1}{y.re} \cdot \left(x.im - \frac{y.im \cdot x.re}{y.re}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \]

Alternative 11: 69.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.7 \cdot 10^{-69} \lor \neg \left(y.im \leq 6.2 \cdot 10^{-69}\right):\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - 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.7e-69) (not (<= y.im 6.2e-69)))
   (/ (- (* x.im (/ y.re y.im)) 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.7e-69) || !(y_46_im <= 6.2e-69)) {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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.7d-69)) .or. (.not. (y_46im <= 6.2d-69))) then
        tmp = ((x_46im * (y_46re / y_46im)) - 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.7e-69) || !(y_46_im <= 6.2e-69)) {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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.7e-69) or not (y_46_im <= 6.2e-69):
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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.7e-69) || !(y_46_im <= 6.2e-69))
		tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - 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.7e-69) || ~((y_46_im <= 6.2e-69)))
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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.7e-69], N[Not[LessEqual[y$46$im, 6.2e-69]], $MachinePrecision]], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{-69} \lor \neg \left(y.im \leq 6.2 \cdot 10^{-69}\right):\\
\;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - 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.70000000000000004e-69 or 6.1999999999999999e-69 < y.im

    1. Initial program 59.9%

      \[\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. *-un-lft-identity59.9%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac59.8%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def59.8%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg50.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. expm1-log1p-u68.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)\right)} \]
      2. expm1-udef31.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)} - 1} \]
      3. associate-*l/31.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1 \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)}{y.im}}\right)} - 1 \]
      4. *-un-lft-identity31.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}} - x.re}}{y.im}\right)} - 1 \]
      5. div-inv31.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{y.im}{y.re}}} - x.re}{y.im}\right)} - 1 \]
      6. clear-num31.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x.im \cdot \color{blue}{\frac{y.re}{y.im}} - x.re}{y.im}\right)} - 1 \]
    9. Applied egg-rr31.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def68.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)\right)} \]
      2. expm1-log1p79.6%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}} \]
    11. Simplified79.6%

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

    if -1.70000000000000004e-69 < y.im < 6.1999999999999999e-69

    1. Initial program 71.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.7 \cdot 10^{-69} \lor \neg \left(y.im \leq 6.2 \cdot 10^{-69}\right):\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]

Alternative 12: 69.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.8 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 3.9 \cdot 10^{-70}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -1.8e-69)
   (* (/ 1.0 y.im) (- (* y.re (/ x.im y.im)) x.re))
   (if (<= y.im 3.9e-70)
     (/ x.im y.re)
     (/ (- (* x.im (/ y.re y.im)) x.re) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -1.8e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 3.9e-70) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - 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 <= (-1.8d-69)) then
        tmp = (1.0d0 / y_46im) * ((y_46re * (x_46im / y_46im)) - x_46re)
    else if (y_46im <= 3.9d-70) then
        tmp = x_46im / y_46re
    else
        tmp = ((x_46im * (y_46re / y_46im)) - 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 <= -1.8e-69) {
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	} else if (y_46_im <= 3.9e-70) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if y_46_im <= -1.8e-69:
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re)
	elif y_46_im <= 3.9e-70:
		tmp = x_46_im / y_46_re
	else:
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -1.8e-69)
		tmp = Float64(Float64(1.0 / y_46_im) * Float64(Float64(y_46_re * Float64(x_46_im / y_46_im)) - x_46_re));
	elseif (y_46_im <= 3.9e-70)
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if (y_46_im <= -1.8e-69)
		tmp = (1.0 / y_46_im) * ((y_46_re * (x_46_im / y_46_im)) - x_46_re);
	elseif (y_46_im <= 3.9e-70)
		tmp = x_46_im / y_46_re;
	else
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.8e-69], N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 3.9e-70], N[(x$46$im / y$46$re), $MachinePrecision], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.80000000000000009e-69

    1. Initial program 63.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. *-un-lft-identity63.7%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac63.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def63.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg20.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. associate-/r/76.6%

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

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

    if -1.80000000000000009e-69 < y.im < 3.90000000000000019e-70

    1. Initial program 71.7%

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

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

    if 3.90000000000000019e-70 < y.im

    1. Initial program 55.8%

      \[\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. *-un-lft-identity55.8%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac55.7%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def55.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{x.im \cdot y.re}{y.im} + \left(-x.re\right)\right)} \]
      3. unsub-neg82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y.im}} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right) \]
    8. Step-by-step derivation
      1. expm1-log1p-u69.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)\right)} \]
      2. expm1-udef28.2%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{y.im} \cdot \left(\frac{x.im}{\frac{y.im}{y.re}} - x.re\right)\right)} - 1} \]
      3. associate-*l/28.2%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}} - x.re}}{y.im}\right)} - 1 \]
      5. div-inv28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x.im \cdot \frac{1}{\frac{y.im}{y.re}}} - x.re}{y.im}\right)} - 1 \]
      6. clear-num28.2%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x.im \cdot \color{blue}{\frac{y.re}{y.im}} - x.re}{y.im}\right)} - 1 \]
    9. Applied egg-rr28.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def69.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\right)\right)} \]
      2. expm1-log1p83.9%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}} \]
    11. Simplified83.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.8 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{y.im} \cdot \left(y.re \cdot \frac{x.im}{y.im} - x.re\right)\\ \mathbf{elif}\;y.im \leq 3.9 \cdot 10^{-70}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \]

Alternative 13: 63.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2.65 \cdot 10^{-55} \lor \neg \left(y.im \leq 1.66 \cdot 10^{-72}\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 -2.65e-55) (not (<= y.im 1.66e-72)))
   (/ (- 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 <= -2.65e-55) || !(y_46_im <= 1.66e-72)) {
		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 <= (-2.65d-55)) .or. (.not. (y_46im <= 1.66d-72))) 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 <= -2.65e-55) || !(y_46_im <= 1.66e-72)) {
		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 <= -2.65e-55) or not (y_46_im <= 1.66e-72):
		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 <= -2.65e-55) || !(y_46_im <= 1.66e-72))
		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 <= -2.65e-55) || ~((y_46_im <= 1.66e-72)))
		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, -2.65e-55], N[Not[LessEqual[y$46$im, 1.66e-72]], $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 -2.65 \cdot 10^{-55} \lor \neg \left(y.im \leq 1.66 \cdot 10^{-72}\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 < -2.6500000000000001e-55 or 1.6600000000000001e-72 < y.im

    1. Initial program 58.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-x.re}}{y.im} \]
    4. Simplified66.8%

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

    if -2.6500000000000001e-55 < y.im < 1.6600000000000001e-72

    1. Initial program 72.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.65 \cdot 10^{-55} \lor \neg \left(y.im \leq 1.66 \cdot 10^{-72}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]

Alternative 14: 46.5% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2.9 \cdot 10^{+130} \lor \neg \left(y.im \leq 7.4 \cdot 10^{+184}\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 -2.9e+130) (not (<= y.im 7.4e+184)))
   (/ 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 <= -2.9e+130) || !(y_46_im <= 7.4e+184)) {
		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 <= (-2.9d+130)) .or. (.not. (y_46im <= 7.4d+184))) 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 <= -2.9e+130) || !(y_46_im <= 7.4e+184)) {
		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 <= -2.9e+130) or not (y_46_im <= 7.4e+184):
		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 <= -2.9e+130) || !(y_46_im <= 7.4e+184))
		tmp = 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 <= -2.9e+130) || ~((y_46_im <= 7.4e+184)))
		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, -2.9e+130], N[Not[LessEqual[y$46$im, 7.4e+184]], $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 -2.9 \cdot 10^{+130} \lor \neg \left(y.im \leq 7.4 \cdot 10^{+184}\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 < -2.8999999999999999e130 or 7.3999999999999995e184 < y.im

    1. Initial program 39.3%

      \[\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. *-un-lft-identity39.3%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac39.3%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def39.3%

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

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

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

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

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

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

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

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

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

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

    if -2.8999999999999999e130 < y.im < 7.3999999999999995e184

    1. Initial program 72.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.9 \cdot 10^{+130} \lor \neg \left(y.im \leq 7.4 \cdot 10^{+184}\right):\\ \;\;\;\;\frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]

Alternative 15: 43.4% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq 2.7 \cdot 10^{+184}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im 2.7e+184) (/ x.im y.re) (/ x.im 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 <= 2.7e+184) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = x_46_im / 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 <= 2.7d+184) then
        tmp = x_46im / y_46re
    else
        tmp = x_46im / 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 <= 2.7e+184) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = x_46_im / 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 <= 2.7e+184:
		tmp = x_46_im / y_46_re
	else:
		tmp = x_46_im / 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 <= 2.7e+184)
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = Float64(x_46_im / 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 <= 2.7e+184)
		tmp = x_46_im / y_46_re;
	else
		tmp = x_46_im / 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, 2.7e+184], N[(x$46$im / y$46$re), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq 2.7 \cdot 10^{+184}:\\
\;\;\;\;\frac{x.im}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < 2.6999999999999999e184

    1. Initial program 68.4%

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

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

    if 2.6999999999999999e184 < y.im

    1. Initial program 29.1%

      \[\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. *-un-lft-identity29.1%

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

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
      3. times-frac29.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-def29.1%

        \[\leadsto \frac{1}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      5. hypot-def58.6%

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

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

      \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(-1 \cdot x.im\right)} \]
    5. Step-by-step derivation
      1. neg-mul-123.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq 2.7 \cdot 10^{+184}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \end{array} \]

Alternative 16: 9.7% accurate, 5.0× speedup?

\[\begin{array}{l} \\ \frac{x.im}{y.im} \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.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_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_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_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return x_46_im / y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(x_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_im;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$im), $MachinePrecision]
\begin{array}{l}

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

    \[\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. *-un-lft-identity64.4%

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

      \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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}}} \]
    3. times-frac64.4%

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
    4. hypot-def64.4%

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

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

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

    \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(-1 \cdot x.im\right)} \]
  5. Step-by-step derivation
    1. neg-mul-125.9%

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

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

    \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
  8. Final simplification10.1%

    \[\leadsto \frac{x.im}{y.im} \]

Reproduce

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