_divideComplex, imaginary part

Percentage Accurate: 61.5% → 89.4%
Time: 14.6s
Alternatives: 13
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 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 61.5% accurate, 1.0× speedup?

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

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

Alternative 1: 89.4% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_1 := x.im \cdot y.re - x.re \cdot y.im\\ t_2 := \frac{t_1}{y.re \cdot y.re + y.im \cdot y.im}\\ t_3 := \frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}\\ \mathbf{if}\;t_2 \leq -1 \cdot 10^{-228}:\\ \;\;\;\;\mathsf{fma}\left(t_0, t_3, \frac{-x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+250}:\\ \;\;\;\;t_0 \cdot \frac{t_1}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t_0, t_3, \frac{-x.re}{y.im}\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 (- (* x.im y.re) (* x.re y.im)))
        (t_2 (/ t_1 (+ (* y.re y.re) (* y.im y.im))))
        (t_3 (/ x.im (/ (hypot y.re y.im) y.re))))
   (if (<= t_2 -1e-228)
     (fma t_0 t_3 (/ (- x.re) (/ (pow (hypot y.re y.im) 2.0) y.im)))
     (if (<= t_2 2e+250)
       (* t_0 (/ t_1 (hypot y.re y.im)))
       (fma t_0 t_3 (/ (- x.re) y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = 1.0 / hypot(y_46_re, y_46_im);
	double t_1 = (x_46_im * y_46_re) - (x_46_re * y_46_im);
	double t_2 = t_1 / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_3 = x_46_im / (hypot(y_46_re, y_46_im) / y_46_re);
	double tmp;
	if (t_2 <= -1e-228) {
		tmp = fma(t_0, t_3, (-x_46_re / (pow(hypot(y_46_re, y_46_im), 2.0) / y_46_im)));
	} else if (t_2 <= 2e+250) {
		tmp = t_0 * (t_1 / hypot(y_46_re, y_46_im));
	} else {
		tmp = fma(t_0, t_3, (-x_46_re / y_46_im));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(1.0 / hypot(y_46_re, y_46_im))
	t_1 = Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im))
	t_2 = Float64(t_1 / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
	t_3 = Float64(x_46_im / Float64(hypot(y_46_re, y_46_im) / y_46_re))
	tmp = 0.0
	if (t_2 <= -1e-228)
		tmp = fma(t_0, t_3, Float64(Float64(-x_46_re) / Float64((hypot(y_46_re, y_46_im) ^ 2.0) / y_46_im)));
	elseif (t_2 <= 2e+250)
		tmp = Float64(t_0 * Float64(t_1 / hypot(y_46_re, y_46_im)));
	else
		tmp = fma(t_0, t_3, Float64(Float64(-x_46_re) / y_46_im));
	end
	return 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[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x$46$im / N[(N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-228], N[(t$95$0 * t$95$3 + N[((-x$46$re) / N[(N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+250], 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 * t$95$3 + N[((-x$46$re) / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+250}:\\
\;\;\;\;t_0 \cdot \frac{t_1}{\mathsf{hypot}\left(y.re, y.im\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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))) < -1.00000000000000003e-228

    1. Initial program 88.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. div-sub81.1%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac81.0%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg81.0%

        \[\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)} \]
      6. hypot-def81.0%

        \[\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) \]
      7. hypot-def85.7%

        \[\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) \]
      8. associate-/l*90.0%

        \[\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) \]
      9. add-sqr-sqrt90.0%

        \[\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) \]
      10. pow290.0%

        \[\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) \]
      11. hypot-def90.0%

        \[\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-rr90.0%

      \[\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. associate-/l*97.7%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac97.7%

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

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

    if -1.00000000000000003e-228 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 1.9999999999999998e250

    1. Initial program 74.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-identity74.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-sqrt74.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-frac74.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-def74.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-def98.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-rr98.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)}} \]

    if 1.9999999999999998e250 < (/.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 17.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. div-sub8.9%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac8.9%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg8.9%

        \[\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)} \]
      6. hypot-def8.9%

        \[\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) \]
      7. hypot-def15.1%

        \[\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) \]
      8. associate-/l*27.1%

        \[\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) \]
      9. add-sqr-sqrt27.1%

        \[\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) \]
      10. pow227.1%

        \[\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) \]
      11. hypot-def27.1%

        \[\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-rr27.1%

      \[\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. associate-/l*58.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq -1 \cdot 10^{-228}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}, \frac{-x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right)\\ \mathbf{elif}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 2 \cdot 10^{+250}:\\ \;\;\;\;\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)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}, \frac{-x.re}{y.im}\right)\\ \end{array} \]

Alternative 2: 89.3% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.im \cdot y.re - x.re \cdot y.im\\ t_1 := \frac{t_0}{y.re \cdot y.re + y.im \cdot y.im}\\ t_2 := \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+179} \lor \neg \left(t_1 \leq 2 \cdot 10^{+250}\right):\\ \;\;\;\;\mathsf{fma}\left(t_2, \frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}, \frac{-x.re}{y.im}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot \frac{t_0}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (- (* x.im y.re) (* x.re y.im)))
        (t_1 (/ t_0 (+ (* y.re y.re) (* y.im y.im))))
        (t_2 (/ 1.0 (hypot y.re y.im))))
   (if (or (<= t_1 -1e+179) (not (<= t_1 2e+250)))
     (fma t_2 (/ x.im (/ (hypot y.re y.im) y.re)) (/ (- x.re) y.im))
     (* t_2 (/ t_0 (hypot y.re y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im * y_46_re) - (x_46_re * y_46_im);
	double t_1 = t_0 / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_2 = 1.0 / hypot(y_46_re, y_46_im);
	double tmp;
	if ((t_1 <= -1e+179) || !(t_1 <= 2e+250)) {
		tmp = fma(t_2, (x_46_im / (hypot(y_46_re, y_46_im) / y_46_re)), (-x_46_re / y_46_im));
	} else {
		tmp = t_2 * (t_0 / hypot(y_46_re, y_46_im));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im))
	t_1 = Float64(t_0 / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
	t_2 = Float64(1.0 / hypot(y_46_re, y_46_im))
	tmp = 0.0
	if ((t_1 <= -1e+179) || !(t_1 <= 2e+250))
		tmp = fma(t_2, Float64(x_46_im / Float64(hypot(y_46_re, y_46_im) / y_46_re)), Float64(Float64(-x_46_re) / y_46_im));
	else
		tmp = Float64(t_2 * Float64(t_0 / hypot(y_46_re, y_46_im)));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+179], N[Not[LessEqual[t$95$1, 2e+250]], $MachinePrecision]], N[(t$95$2 * N[(x$46$im / N[(N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] + N[((-x$46$re) / y$46$im), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_2 \cdot \frac{t_0}{\mathsf{hypot}\left(y.re, y.im\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))) < -9.9999999999999998e178 or 1.9999999999999998e250 < (/.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 31.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. div-sub19.7%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac19.7%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg19.7%

        \[\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)} \]
      6. hypot-def19.7%

        \[\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) \]
      7. hypot-def27.7%

        \[\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) \]
      8. associate-/l*39.5%

        \[\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) \]
      9. add-sqr-sqrt39.5%

        \[\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) \]
      10. pow239.5%

        \[\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) \]
      11. hypot-def39.5%

        \[\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-rr39.5%

      \[\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. associate-/l*68.1%

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

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

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

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

    if -9.9999999999999998e178 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 1.9999999999999998e250

    1. Initial program 81.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-identity81.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-sqrt81.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-frac81.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-def81.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-def98.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-rr98.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)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq -1 \cdot 10^{+179} \lor \neg \left(\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 2 \cdot 10^{+250}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}, \frac{-x.re}{y.im}\right)\\ \mathbf{else}:\\ \;\;\;\;\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)}\\ \end{array} \]

Alternative 3: 88.4% accurate, 0.1× speedup?

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

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

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


\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))) < 1.9999999999999998e250

    1. Initial program 79.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-identity79.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-sqrt79.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-frac79.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-def79.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-def95.2%

        \[\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-rr95.2%

      \[\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 1.9999999999999998e250 < (/.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 17.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. div-sub8.9%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac8.9%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg8.9%

        \[\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)} \]
      6. hypot-def8.9%

        \[\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) \]
      7. hypot-def15.1%

        \[\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) \]
      8. associate-/l*27.1%

        \[\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) \]
      9. add-sqr-sqrt27.1%

        \[\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) \]
      10. pow227.1%

        \[\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) \]
      11. hypot-def27.1%

        \[\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-rr27.1%

      \[\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. associate-/l*58.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq 2 \cdot 10^{+250}:\\ \;\;\;\;\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)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \end{array} \]

Alternative 4: 80.5% accurate, 0.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -7.0000000000000001e81

    1. Initial program 44.6%

      \[\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-sub44.6%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac44.5%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg44.5%

        \[\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)} \]
      6. hypot-def44.5%

        \[\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) \]
      7. hypot-def57.8%

        \[\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) \]
      8. associate-/l*62.0%

        \[\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) \]
      9. add-sqr-sqrt62.0%

        \[\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) \]
      10. pow262.0%

        \[\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) \]
      11. hypot-def62.0%

        \[\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-rr62.0%

      \[\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. associate-/l*84.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac85.4%

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

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

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

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

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

    if -7.0000000000000001e81 < y.re < 6.4999999999999997e91

    1. Initial program 75.6%

      \[\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-sub68.5%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac68.5%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg68.5%

        \[\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)} \]
      6. hypot-def68.5%

        \[\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) \]
      7. hypot-def73.7%

        \[\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) \]
      8. associate-/l*79.7%

        \[\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) \]
      9. add-sqr-sqrt79.7%

        \[\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) \]
      10. pow279.7%

        \[\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) \]
      11. hypot-def79.7%

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

      \[\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. associate-/l*81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.4999999999999997e91 < y.re

    1. Initial program 35.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. div-sub35.7%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac35.8%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg35.8%

        \[\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)} \]
      6. hypot-def35.8%

        \[\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) \]
      7. hypot-def55.5%

        \[\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) \]
      8. associate-/l*57.7%

        \[\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) \]
      9. add-sqr-sqrt57.7%

        \[\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) \]
      10. pow257.7%

        \[\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) \]
      11. hypot-def57.7%

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

      \[\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. associate-/l*87.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac88.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -7 \cdot 10^{+81}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.re \leq 6.5 \cdot 10^{+91}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{y.im}{y.re} \cdot \frac{x.re}{y.re}\\ \end{array} \]

Alternative 5: 80.1% accurate, 0.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -1.22e14

    1. Initial program 50.6%

      \[\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-sub50.6%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac50.6%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg50.6%

        \[\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)} \]
      6. hypot-def50.6%

        \[\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) \]
      7. hypot-def62.0%

        \[\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) \]
      8. associate-/l*65.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) \]
      9. add-sqr-sqrt65.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) \]
      10. pow265.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) \]
      11. hypot-def65.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-rr65.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. associate-/l*85.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.22e14 < y.re < 1.1e-73

    1. Initial program 74.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-sub64.7%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac64.7%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg64.7%

        \[\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)} \]
      6. hypot-def64.7%

        \[\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) \]
      7. hypot-def71.0%

        \[\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) \]
      8. associate-/l*79.1%

        \[\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) \]
      9. add-sqr-sqrt79.1%

        \[\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) \]
      10. pow279.1%

        \[\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) \]
      11. hypot-def79.1%

        \[\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-rr79.1%

      \[\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. associate-/l*79.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac79.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      6. times-frac82.7%

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

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

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

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

    if 1.1e-73 < y.re < 1.14999999999999999e95

    1. Initial program 86.1%

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

    if 1.14999999999999999e95 < y.re

    1. Initial program 31.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. div-sub31.5%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac31.5%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg31.5%

        \[\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)} \]
      6. hypot-def31.5%

        \[\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) \]
      7. hypot-def52.6%

        \[\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) \]
      8. associate-/l*54.9%

        \[\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) \]
      9. add-sqr-sqrt54.9%

        \[\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) \]
      10. pow254.9%

        \[\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) \]
      11. hypot-def54.9%

        \[\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-rr54.9%

      \[\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. associate-/l*87.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac89.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -1.22 \cdot 10^{+14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.re \leq 1.1 \cdot 10^{-73}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im}}{y.im} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.15 \cdot 10^{+95}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{y.im}{y.re} \cdot \frac{x.re}{y.re}\\ \end{array} \]

Alternative 6: 73.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \frac{x.im}{y.im \cdot y.im} - \frac{x.re}{y.im}\\ \mathbf{if}\;y.re \leq -3.7 \cdot 10^{+14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.re \leq -8.7 \cdot 10^{-221}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.re \leq 1.16 \cdot 10^{-206}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 8.2 \cdot 10^{+49}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (- (* y.re (/ x.im (* y.im y.im))) (/ x.re y.im))))
   (if (<= y.re -3.7e+14)
     (/ (- x.im (* x.re (/ y.im y.re))) y.re)
     (if (<= y.re -8.7e-221)
       t_0
       (if (<= y.re 1.16e-206)
         (/ (- x.re) y.im)
         (if (<= y.re 8.2e+49)
           t_0
           (/ (- x.im (* y.im (/ x.re y.re))) y.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 / (y_46_im * y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_re <= -3.7e+14) {
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	} else if (y_46_re <= -8.7e-221) {
		tmp = t_0;
	} else if (y_46_re <= 1.16e-206) {
		tmp = -x_46_re / y_46_im;
	} else if (y_46_re <= 8.2e+49) {
		tmp = t_0;
	} else {
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / 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) :: t_0
    real(8) :: tmp
    t_0 = (y_46re * (x_46im / (y_46im * y_46im))) - (x_46re / y_46im)
    if (y_46re <= (-3.7d+14)) then
        tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
    else if (y_46re <= (-8.7d-221)) then
        tmp = t_0
    else if (y_46re <= 1.16d-206) then
        tmp = -x_46re / y_46im
    else if (y_46re <= 8.2d+49) then
        tmp = t_0
    else
        tmp = (x_46im - (y_46im * (x_46re / y_46re))) / 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 t_0 = (y_46_re * (x_46_im / (y_46_im * y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_re <= -3.7e+14) {
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	} else if (y_46_re <= -8.7e-221) {
		tmp = t_0;
	} else if (y_46_re <= 1.16e-206) {
		tmp = -x_46_re / y_46_im;
	} else if (y_46_re <= 8.2e+49) {
		tmp = t_0;
	} else {
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_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 / (y_46_im * y_46_im))) - (x_46_re / y_46_im)
	tmp = 0
	if y_46_re <= -3.7e+14:
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re
	elif y_46_re <= -8.7e-221:
		tmp = t_0
	elif y_46_re <= 1.16e-206:
		tmp = -x_46_re / y_46_im
	elif y_46_re <= 8.2e+49:
		tmp = t_0
	else:
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(y_46_re * Float64(x_46_im / Float64(y_46_im * y_46_im))) - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_re <= -3.7e+14)
		tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re);
	elseif (y_46_re <= -8.7e-221)
		tmp = t_0;
	elseif (y_46_re <= 1.16e-206)
		tmp = Float64(Float64(-x_46_re) / y_46_im);
	elseif (y_46_re <= 8.2e+49)
		tmp = t_0;
	else
		tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = (y_46_re * (x_46_im / (y_46_im * y_46_im))) - (x_46_re / y_46_im);
	tmp = 0.0;
	if (y_46_re <= -3.7e+14)
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	elseif (y_46_re <= -8.7e-221)
		tmp = t_0;
	elseif (y_46_re <= 1.16e-206)
		tmp = -x_46_re / y_46_im;
	elseif (y_46_re <= 8.2e+49)
		tmp = t_0;
	else
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re * N[(x$46$im / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -3.7e+14], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -8.7e-221], t$95$0, If[LessEqual[y$46$re, 1.16e-206], N[((-x$46$re) / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 8.2e+49], t$95$0, N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y.re \cdot \frac{x.im}{y.im \cdot y.im} - \frac{x.re}{y.im}\\
\mathbf{if}\;y.re \leq -3.7 \cdot 10^{+14}:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\

\mathbf{elif}\;y.re \leq -8.7 \cdot 10^{-221}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y.re \leq 8.2 \cdot 10^{+49}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -3.7e14

    1. Initial program 50.6%

      \[\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-sub50.6%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac50.6%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg50.6%

        \[\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)} \]
      6. hypot-def50.6%

        \[\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) \]
      7. hypot-def62.0%

        \[\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) \]
      8. associate-/l*65.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) \]
      9. add-sqr-sqrt65.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) \]
      10. pow265.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) \]
      11. hypot-def65.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-rr65.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. associate-/l*85.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.7e14 < y.re < -8.7000000000000003e-221 or 1.16000000000000004e-206 < y.re < 8.2e49

    1. Initial program 77.0%

      \[\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 76.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x.im}{\frac{y.im \cdot y.im}{y.re}}} - \frac{x.re}{y.im} \]
      6. associate-/r/76.7%

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

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

    if -8.7000000000000003e-221 < y.re < 1.16000000000000004e-206

    1. Initial program 70.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 83.8%

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

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

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

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

    if 8.2e49 < y.re

    1. Initial program 44.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. div-sub44.8%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac44.8%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg44.8%

        \[\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)} \]
      6. hypot-def44.8%

        \[\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) \]
      7. hypot-def61.7%

        \[\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) \]
      8. associate-/l*63.6%

        \[\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) \]
      9. add-sqr-sqrt63.6%

        \[\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) \]
      10. pow263.6%

        \[\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) \]
      11. hypot-def63.6%

        \[\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-rr63.6%

      \[\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. associate-/l*89.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac89.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac83.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -3.7 \cdot 10^{+14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.re \leq -8.7 \cdot 10^{-221}:\\ \;\;\;\;y.re \cdot \frac{x.im}{y.im \cdot y.im} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.16 \cdot 10^{-206}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 8.2 \cdot 10^{+49}:\\ \;\;\;\;y.re \cdot \frac{x.im}{y.im \cdot y.im} - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\ \end{array} \]

Alternative 7: 76.8% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -5.6e14

    1. Initial program 50.6%

      \[\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-sub50.6%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac50.6%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg50.6%

        \[\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)} \]
      6. hypot-def50.6%

        \[\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) \]
      7. hypot-def62.0%

        \[\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) \]
      8. associate-/l*65.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) \]
      9. add-sqr-sqrt65.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) \]
      10. pow265.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) \]
      11. hypot-def65.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-rr65.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. associate-/l*85.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.6e14 < y.re < 2.4e49

    1. Initial program 74.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. div-sub66.5%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac66.5%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg66.5%

        \[\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)} \]
      6. hypot-def66.5%

        \[\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) \]
      7. hypot-def71.9%

        \[\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) \]
      8. associate-/l*79.0%

        \[\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) \]
      9. add-sqr-sqrt79.0%

        \[\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) \]
      10. pow279.0%

        \[\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) \]
      11. hypot-def79.0%

        \[\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-rr79.0%

      \[\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. associate-/l*79.4%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac79.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      6. times-frac80.4%

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

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

    if 2.4e49 < y.re

    1. Initial program 44.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. div-sub44.8%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac44.8%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg44.8%

        \[\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)} \]
      6. hypot-def44.8%

        \[\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) \]
      7. hypot-def61.7%

        \[\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) \]
      8. associate-/l*63.6%

        \[\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) \]
      9. add-sqr-sqrt63.6%

        \[\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) \]
      10. pow263.6%

        \[\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) \]
      11. hypot-def63.6%

        \[\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-rr63.6%

      \[\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. associate-/l*89.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac89.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac83.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -5.6 \cdot 10^{+14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.re \leq 2.4 \cdot 10^{+49}:\\ \;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\ \end{array} \]

Alternative 8: 76.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -22000000000000:\\
\;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -2.2e13

    1. Initial program 50.6%

      \[\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-sub50.6%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac50.6%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg50.6%

        \[\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)} \]
      6. hypot-def50.6%

        \[\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) \]
      7. hypot-def62.0%

        \[\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) \]
      8. associate-/l*65.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) \]
      9. add-sqr-sqrt65.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) \]
      10. pow265.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) \]
      11. hypot-def65.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-rr65.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. associate-/l*85.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2e13 < y.re < 1.79999999999999993e50

    1. Initial program 74.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. div-sub66.5%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac66.5%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg66.5%

        \[\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)} \]
      6. hypot-def66.5%

        \[\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) \]
      7. hypot-def71.9%

        \[\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) \]
      8. associate-/l*79.0%

        \[\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) \]
      9. add-sqr-sqrt79.0%

        \[\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) \]
      10. pow279.0%

        \[\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) \]
      11. hypot-def79.0%

        \[\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-rr79.0%

      \[\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. associate-/l*79.4%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac79.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      6. times-frac80.4%

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

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

    if 1.79999999999999993e50 < y.re

    1. Initial program 44.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. div-sub44.8%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac44.8%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg44.8%

        \[\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)} \]
      6. hypot-def44.8%

        \[\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) \]
      7. hypot-def61.7%

        \[\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) \]
      8. associate-/l*63.6%

        \[\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) \]
      9. add-sqr-sqrt63.6%

        \[\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) \]
      10. pow263.6%

        \[\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) \]
      11. hypot-def63.6%

        \[\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-rr63.6%

      \[\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. associate-/l*89.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac89.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac83.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -22000000000000:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.re \leq 1.8 \cdot 10^{+50}:\\ \;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{y.im}{y.re} \cdot \frac{x.re}{y.re}\\ \end{array} \]

Alternative 9: 77.5% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -3.8e14

    1. Initial program 50.6%

      \[\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-sub50.6%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac50.6%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg50.6%

        \[\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)} \]
      6. hypot-def50.6%

        \[\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) \]
      7. hypot-def62.0%

        \[\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) \]
      8. associate-/l*65.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) \]
      9. add-sqr-sqrt65.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) \]
      10. pow265.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) \]
      11. hypot-def65.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-rr65.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. associate-/l*85.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8e14 < y.re < 2.69999999999999992e51

    1. Initial program 74.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. div-sub66.5%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac66.5%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg66.5%

        \[\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)} \]
      6. hypot-def66.5%

        \[\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) \]
      7. hypot-def71.9%

        \[\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) \]
      8. associate-/l*79.0%

        \[\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) \]
      9. add-sqr-sqrt79.0%

        \[\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) \]
      10. pow279.0%

        \[\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) \]
      11. hypot-def79.0%

        \[\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-rr79.0%

      \[\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. associate-/l*79.4%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac79.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      6. times-frac80.4%

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

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

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

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

    if 2.69999999999999992e51 < y.re

    1. Initial program 44.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. div-sub44.8%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac44.8%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg44.8%

        \[\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)} \]
      6. hypot-def44.8%

        \[\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) \]
      7. hypot-def61.7%

        \[\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) \]
      8. associate-/l*63.6%

        \[\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) \]
      9. add-sqr-sqrt63.6%

        \[\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) \]
      10. pow263.6%

        \[\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) \]
      11. hypot-def63.6%

        \[\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-rr63.6%

      \[\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. associate-/l*89.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac89.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac83.0%

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

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

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

Alternative 10: 69.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -420000000000 \lor \neg \left(y.re \leq 1.35 \cdot 10^{+47}\right):\\ \;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.re -420000000000.0) (not (<= y.re 1.35e+47)))
   (/ (- x.im (* y.im (/ x.re y.re))) y.re)
   (/ (- x.re) y.im)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_re <= -420000000000.0) || !(y_46_re <= 1.35e+47)) {
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
	} else {
		tmp = -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_46re <= (-420000000000.0d0)) .or. (.not. (y_46re <= 1.35d+47))) then
        tmp = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
    else
        tmp = -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_re <= -420000000000.0) || !(y_46_re <= 1.35e+47)) {
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
	} else {
		tmp = -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_re <= -420000000000.0) or not (y_46_re <= 1.35e+47):
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re
	else:
		tmp = -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_re <= -420000000000.0) || !(y_46_re <= 1.35e+47))
		tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re);
	else
		tmp = Float64(Float64(-x_46_re) / y_46_im);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_re <= -420000000000.0) || ~((y_46_re <= 1.35e+47)))
		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
	else
		tmp = -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[Or[LessEqual[y$46$re, -420000000000.0], N[Not[LessEqual[y$46$re, 1.35e+47]], $MachinePrecision]], N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[((-x$46$re) / y$46$im), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -4.2e11 or 1.34999999999999998e47 < y.re

    1. Initial program 48.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. div-sub48.0%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac47.9%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg47.9%

        \[\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)} \]
      6. hypot-def47.9%

        \[\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) \]
      7. hypot-def61.9%

        \[\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) \]
      8. associate-/l*64.5%

        \[\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) \]
      9. add-sqr-sqrt64.5%

        \[\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) \]
      10. pow264.5%

        \[\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) \]
      11. hypot-def64.5%

        \[\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-rr64.5%

      \[\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. associate-/l*87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.2e11 < y.re < 1.34999999999999998e47

    1. Initial program 74.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 65.2%

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

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

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

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

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

Alternative 11: 70.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.8 \cdot 10^{+128} \lor \neg \left(y.im \leq 1.1 \cdot 10^{+141}\right):\\
\;\;\;\;\frac{-x.re}{y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -1.80000000000000014e128 or 1.1e141 < y.im

    1. Initial program 45.0%

      \[\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 78.2%

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

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

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

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

    if -1.80000000000000014e128 < y.im < 1.1e141

    1. Initial program 69.2%

      \[\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-sub63.0%

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

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

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac63.0%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. fma-neg63.0%

        \[\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)} \]
      6. hypot-def63.0%

        \[\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) \]
      7. hypot-def75.5%

        \[\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) \]
      8. associate-/l*81.5%

        \[\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) \]
      9. add-sqr-sqrt81.5%

        \[\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) \]
      10. pow281.5%

        \[\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) \]
      11. hypot-def81.5%

        \[\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-rr81.5%

      \[\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. associate-/l*92.5%

        \[\leadsto \mathsf{fma}\left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}, \color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}}, -\frac{x.re}{\frac{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}{y.im}}\right) \]
      2. distribute-neg-frac92.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{\color{blue}{y.re \cdot y.re}} \]
      6. times-frac68.9%

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

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

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

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

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

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

Alternative 12: 64.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq 2.75 \cdot 10^{+51}:\\ \;\;\;\;\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 (<= y.re -2.5e-10)
   (/ x.im y.re)
   (if (<= y.re 2.75e+51) (/ (- 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_re <= -2.5e-10) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= 2.75e+51) {
		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_46re <= (-2.5d-10)) then
        tmp = x_46im / y_46re
    else if (y_46re <= 2.75d+51) 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_re <= -2.5e-10) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= 2.75e+51) {
		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_re <= -2.5e-10:
		tmp = x_46_im / y_46_re
	elif y_46_re <= 2.75e+51:
		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_re <= -2.5e-10)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= 2.75e+51)
		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_re <= -2.5e-10)
		tmp = x_46_im / y_46_re;
	elseif (y_46_re <= 2.75e+51)
		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[LessEqual[y$46$re, -2.5e-10], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2.75e+51], 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.re \leq -2.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{x.im}{y.re}\\

\mathbf{elif}\;y.re \leq 2.75 \cdot 10^{+51}:\\
\;\;\;\;\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.re < -2.50000000000000016e-10 or 2.75e51 < y.re

    1. Initial program 48.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 68.5%

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

    if -2.50000000000000016e-10 < y.re < 2.75e51

    1. Initial program 74.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 65.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq 2.75 \cdot 10^{+51}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]

Alternative 13: 42.7% accurate, 5.0× speedup?

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

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

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

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

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

Reproduce

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