_divideComplex, imaginary part

Percentage Accurate: 61.7% → 82.7%
Time: 8.7s
Alternatives: 9
Speedup: 1.5×

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 9 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.7% 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: 82.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ t_1 := \mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)\\ \mathbf{if}\;y.im \leq -5 \cdot 10^{+124}:\\ \;\;\;\;\frac{1}{\frac{y.im}{t\_1}}\\ \mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-137}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_1}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (/ (- (* y.re x.im) (* x.re y.im)) (+ (* y.im y.im) (* y.re y.re))))
        (t_1 (fma (/ x.im y.im) y.re (- x.re))))
   (if (<= y.im -5e+124)
     (/ 1.0 (/ y.im t_1))
     (if (<= y.im -2.6e-107)
       t_0
       (if (<= y.im 3.4e-137)
         (/ (- x.im (/ (* x.re y.im) y.re)) y.re)
         (if (<= y.im 4.5e+45) t_0 (/ t_1 y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	double t_1 = fma((x_46_im / y_46_im), y_46_re, -x_46_re);
	double tmp;
	if (y_46_im <= -5e+124) {
		tmp = 1.0 / (y_46_im / t_1);
	} else if (y_46_im <= -2.6e-107) {
		tmp = t_0;
	} else if (y_46_im <= 3.4e-137) {
		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
	} else if (y_46_im <= 4.5e+45) {
		tmp = t_0;
	} else {
		tmp = t_1 / y_46_im;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re)))
	t_1 = fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re))
	tmp = 0.0
	if (y_46_im <= -5e+124)
		tmp = Float64(1.0 / Float64(y_46_im / t_1));
	elseif (y_46_im <= -2.6e-107)
		tmp = t_0;
	elseif (y_46_im <= 3.4e-137)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re);
	elseif (y_46_im <= 4.5e+45)
		tmp = t_0;
	else
		tmp = Float64(t_1 / 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[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision]}, If[LessEqual[y$46$im, -5e+124], N[(1.0 / N[(y$46$im / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -2.6e-107], t$95$0, If[LessEqual[y$46$im, 3.4e-137], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.5e+45], t$95$0, N[(t$95$1 / y$46$im), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{y.im}\\


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

    1. Initial program 21.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re - x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. div-subN/A

        \[\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}} \]
      4. sub-negN/A

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      7. associate-/l*N/A

        \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im} \cdot y.re} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      11. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      12. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      13. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im} + y.re \cdot y.re}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      17. associate-/l*N/A

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

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

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

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

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re}{y.im}\right)\right)} \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. unpow2N/A

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      5. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      6. div-subN/A

        \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
      8. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + \left(\mathsf{neg}\left(x.re\right)\right)}}{y.im} \]
      9. mul-1-negN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + \color{blue}{-1 \cdot x.re}}{y.im} \]
      10. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{x.im}{y.im} \cdot y.re} + -1 \cdot x.re}{y.im} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}}{y.im} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{x.im}{y.im}}, y.re, -1 \cdot x.re\right)}{y.im} \]
      13. mul-1-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
      14. lower-neg.f6485.7

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{-x.re}\right)}{y.im} \]
    7. Applied rewrites85.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}} \]
    8. Step-by-step derivation
      1. Applied rewrites86.8%

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

      if -4.9999999999999996e124 < y.im < -2.6000000000000001e-107 or 3.40000000000000014e-137 < y.im < 4.4999999999999998e45

      1. Initial program 86.6%

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

      if -2.6000000000000001e-107 < y.im < 3.40000000000000014e-137

      1. Initial program 73.6%

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

        \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
        2. mul-1-negN/A

          \[\leadsto \frac{x.im + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}}{y.re} \]
        3. unsub-negN/A

          \[\leadsto \frac{\color{blue}{x.im - \frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        4. lower--.f64N/A

          \[\leadsto \frac{\color{blue}{x.im - \frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        6. lower-*.f6490.3

          \[\leadsto \frac{x.im - \frac{\color{blue}{x.re \cdot y.im}}{y.re}}{y.re} \]
      5. Applied rewrites90.3%

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

      if 4.4999999999999998e45 < y.im

      1. Initial program 43.9%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re - x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
        3. div-subN/A

          \[\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}} \]
        4. sub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        7. associate-/l*N/A

          \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im} \cdot y.re} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        9. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        10. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        11. lift-+.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        12. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        13. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im} + y.re \cdot y.re}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        14. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        17. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\color{blue}{y.im \cdot \frac{x.re}{y.re \cdot y.re + y.im \cdot y.im}}\right)\right) \]
      4. Applied rewrites51.1%

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

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

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

          \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re}{y.im}\right)\right)} \]
        3. unsub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
        4. unpow2N/A

          \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
        5. associate-/r*N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
        6. div-subN/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        8. sub-negN/A

          \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + \left(\mathsf{neg}\left(x.re\right)\right)}}{y.im} \]
        9. mul-1-negN/A

          \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + \color{blue}{-1 \cdot x.re}}{y.im} \]
        10. associate-*l/N/A

          \[\leadsto \frac{\color{blue}{\frac{x.im}{y.im} \cdot y.re} + -1 \cdot x.re}{y.im} \]
        11. lower-fma.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}}{y.im} \]
        12. lower-/.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{x.im}{y.im}}, y.re, -1 \cdot x.re\right)}{y.im} \]
        13. mul-1-negN/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
        14. lower-neg.f6483.7

          \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{-x.re}\right)}{y.im} \]
      7. Applied rewrites83.7%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -5 \cdot 10^{+124}:\\ \;\;\;\;\frac{1}{\frac{y.im}{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}}\\ \mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-137}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \end{array} \]
    11. Add Preprocessing

    Alternative 2: 82.8% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ t_1 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \mathbf{if}\;y.im \leq -6.4 \cdot 10^{+122}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-137}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0
             (/ (- (* y.re x.im) (* x.re y.im)) (+ (* y.im y.im) (* y.re y.re))))
            (t_1 (/ (fma (/ x.im y.im) y.re (- x.re)) y.im)))
       (if (<= y.im -6.4e+122)
         t_1
         (if (<= y.im -2.6e-107)
           t_0
           (if (<= y.im 3.4e-137)
             (/ (- x.im (/ (* x.re y.im) y.re)) y.re)
             (if (<= y.im 4.5e+45) t_0 t_1))))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
    	double t_1 = fma((x_46_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
    	double tmp;
    	if (y_46_im <= -6.4e+122) {
    		tmp = t_1;
    	} else if (y_46_im <= -2.6e-107) {
    		tmp = t_0;
    	} else if (y_46_im <= 3.4e-137) {
    		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
    	} else if (y_46_im <= 4.5e+45) {
    		tmp = t_0;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re)))
    	t_1 = Float64(fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -6.4e+122)
    		tmp = t_1;
    	elseif (y_46_im <= -2.6e-107)
    		tmp = t_0;
    	elseif (y_46_im <= 3.4e-137)
    		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re);
    	elseif (y_46_im <= 4.5e+45)
    		tmp = t_0;
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -6.4e+122], t$95$1, If[LessEqual[y$46$im, -2.6e-107], t$95$0, If[LessEqual[y$46$im, 3.4e-137], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 4.5e+45], t$95$0, t$95$1]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\
    t_1 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
    \mathbf{if}\;y.im \leq -6.4 \cdot 10^{+122}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-137}:\\
    \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
    
    \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.im < -6.40000000000000024e122 or 4.4999999999999998e45 < y.im

      1. Initial program 34.0%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re - x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
        3. div-subN/A

          \[\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}} \]
        4. sub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        7. associate-/l*N/A

          \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im} \cdot y.re} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        9. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        10. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        11. lift-+.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        12. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        13. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im} + y.re \cdot y.re}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        14. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        17. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\color{blue}{y.im \cdot \frac{x.re}{y.re \cdot y.re + y.im \cdot y.im}}\right)\right) \]
      4. Applied rewrites41.3%

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

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

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

          \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re}{y.im}\right)\right)} \]
        3. unsub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
        4. unpow2N/A

          \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
        5. associate-/r*N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
        6. div-subN/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        8. sub-negN/A

          \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + \left(\mathsf{neg}\left(x.re\right)\right)}}{y.im} \]
        9. mul-1-negN/A

          \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + \color{blue}{-1 \cdot x.re}}{y.im} \]
        10. associate-*l/N/A

          \[\leadsto \frac{\color{blue}{\frac{x.im}{y.im} \cdot y.re} + -1 \cdot x.re}{y.im} \]
        11. lower-fma.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}}{y.im} \]
        12. lower-/.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{x.im}{y.im}}, y.re, -1 \cdot x.re\right)}{y.im} \]
        13. mul-1-negN/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
        14. lower-neg.f6484.6

          \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{-x.re}\right)}{y.im} \]
      7. Applied rewrites84.6%

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

      if -6.40000000000000024e122 < y.im < -2.6000000000000001e-107 or 3.40000000000000014e-137 < y.im < 4.4999999999999998e45

      1. Initial program 86.6%

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

      if -2.6000000000000001e-107 < y.im < 3.40000000000000014e-137

      1. Initial program 73.6%

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

        \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
        2. mul-1-negN/A

          \[\leadsto \frac{x.im + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}}{y.re} \]
        3. unsub-negN/A

          \[\leadsto \frac{\color{blue}{x.im - \frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        4. lower--.f64N/A

          \[\leadsto \frac{\color{blue}{x.im - \frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        6. lower-*.f6490.3

          \[\leadsto \frac{x.im - \frac{\color{blue}{x.re \cdot y.im}}{y.re}}{y.re} \]
      5. Applied rewrites90.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -6.4 \cdot 10^{+122}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-107}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-137}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{+45}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 3: 65.6% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ t_1 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{if}\;y.im \leq -1.1 \cdot 10^{+72}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq -0.009:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\ \;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\ \mathbf{elif}\;y.im \leq 1.8 \cdot 10^{-41}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+159}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (/ (- x.re) y.im))
            (t_1 (/ (- (* y.re x.im) (* x.re y.im)) (* y.im y.im))))
       (if (<= y.im -1.1e+72)
         t_0
         (if (<= y.im -0.009)
           t_1
           (if (<= y.im -8.6e-106)
             (* (/ y.im (fma y.im y.im (* y.re y.re))) (- x.re))
             (if (<= y.im 1.8e-41)
               (/ x.im y.re)
               (if (<= y.im 1.85e+159) t_1 t_0)))))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = -x_46_re / y_46_im;
    	double t_1 = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_im * y_46_im);
    	double tmp;
    	if (y_46_im <= -1.1e+72) {
    		tmp = t_0;
    	} else if (y_46_im <= -0.009) {
    		tmp = t_1;
    	} else if (y_46_im <= -8.6e-106) {
    		tmp = (y_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * -x_46_re;
    	} else if (y_46_im <= 1.8e-41) {
    		tmp = x_46_im / y_46_re;
    	} else if (y_46_im <= 1.85e+159) {
    		tmp = t_1;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(Float64(-x_46_re) / y_46_im)
    	t_1 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(y_46_im * y_46_im))
    	tmp = 0.0
    	if (y_46_im <= -1.1e+72)
    		tmp = t_0;
    	elseif (y_46_im <= -0.009)
    		tmp = t_1;
    	elseif (y_46_im <= -8.6e-106)
    		tmp = Float64(Float64(y_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * Float64(-x_46_re));
    	elseif (y_46_im <= 1.8e-41)
    		tmp = Float64(x_46_im / y_46_re);
    	elseif (y_46_im <= 1.85e+159)
    		tmp = t_1;
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.1e+72], t$95$0, If[LessEqual[y$46$im, -0.009], t$95$1, If[LessEqual[y$46$im, -8.6e-106], N[(N[(y$46$im / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-x$46$re)), $MachinePrecision], If[LessEqual[y$46$im, 1.8e-41], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.85e+159], t$95$1, t$95$0]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{-x.re}{y.im}\\
    t_1 := \frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\
    \mathbf{if}\;y.im \leq -1.1 \cdot 10^{+72}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq -0.009:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\
    \;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\
    
    \mathbf{elif}\;y.im \leq 1.8 \cdot 10^{-41}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    \mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+159}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if y.im < -1.1e72 or 1.85e159 < y.im

      1. Initial program 27.4%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{x.re}{y.im}\right)} \]
        2. distribute-neg-frac2N/A

          \[\leadsto \color{blue}{\frac{x.re}{\mathsf{neg}\left(y.im\right)}} \]
        3. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{-1 \cdot y.im}} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.re}{-1 \cdot y.im}} \]
        5. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
        6. lower-neg.f6474.9

          \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
      5. Applied rewrites74.9%

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

      if -1.1e72 < y.im < -0.00899999999999999932 or 1.8e-41 < y.im < 1.85e159

      1. Initial program 78.3%

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

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

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
        2. lower-*.f6466.5

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

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

      if -0.00899999999999999932 < y.im < -8.6000000000000004e-106

      1. Initial program 90.3%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.im}^{2} + {y.re}^{2}}} \]
      4. Step-by-step derivation
        1. associate-/l*N/A

          \[\leadsto -1 \cdot \color{blue}{\left(x.re \cdot \frac{y.im}{{y.im}^{2} + {y.re}^{2}}\right)} \]
        2. associate-*r*N/A

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

          \[\leadsto \color{blue}{\left(-1 \cdot x.re\right) \cdot \frac{y.im}{{y.im}^{2} + {y.re}^{2}}} \]
        4. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x.re\right)\right)} \cdot \frac{y.im}{{y.im}^{2} + {y.re}^{2}} \]
        5. lower-neg.f64N/A

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

          \[\leadsto \left(-x.re\right) \cdot \color{blue}{\frac{y.im}{{y.im}^{2} + {y.re}^{2}}} \]
        7. unpow2N/A

          \[\leadsto \left(-x.re\right) \cdot \frac{y.im}{\color{blue}{y.im \cdot y.im} + {y.re}^{2}} \]
        8. lower-fma.f64N/A

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

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

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

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

      if -8.6000000000000004e-106 < y.im < 1.8e-41

      1. Initial program 76.7%

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f6471.8

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      5. Applied rewrites71.8%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.1 \cdot 10^{+72}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -0.009:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\ \;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\ \mathbf{elif}\;y.im \leq 1.8 \cdot 10^{-41}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+159}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 4: 71.3% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -3 \cdot 10^{+133}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq 1.3 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \mathbf{elif}\;y.re \leq 4.5 \cdot 10^{+62}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.re \cdot y.re}\\ \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 -3e+133)
       (/ x.im y.re)
       (if (<= y.re 1.3e-62)
         (/ (fma (/ x.im y.im) y.re (- x.re)) y.im)
         (if (<= y.re 4.5e+62)
           (/ (- (* y.re x.im) (* x.re y.im)) (* y.re y.re))
           (/ 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 <= -3e+133) {
    		tmp = x_46_im / y_46_re;
    	} else if (y_46_re <= 1.3e-62) {
    		tmp = fma((x_46_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
    	} else if (y_46_re <= 4.5e+62) {
    		tmp = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_re * y_46_re);
    	} 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 <= -3e+133)
    		tmp = Float64(x_46_im / y_46_re);
    	elseif (y_46_re <= 1.3e-62)
    		tmp = Float64(fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im);
    	elseif (y_46_re <= 4.5e+62)
    		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(y_46_re * y_46_re));
    	else
    		tmp = Float64(x_46_im / y_46_re);
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -3e+133], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 1.3e-62], N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 4.5e+62], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.re \leq -3 \cdot 10^{+133}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    \mathbf{elif}\;y.re \leq 1.3 \cdot 10^{-62}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
    
    \mathbf{elif}\;y.re \leq 4.5 \cdot 10^{+62}:\\
    \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.re \cdot y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.re < -3.00000000000000007e133 or 4.49999999999999999e62 < y.re

      1. Initial program 39.5%

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f6474.9

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      5. Applied rewrites74.9%

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

      if -3.00000000000000007e133 < y.re < 1.3e-62

      1. Initial program 74.5%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re - x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
        3. div-subN/A

          \[\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}} \]
        4. sub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        7. associate-/l*N/A

          \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im} \cdot y.re} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        9. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        10. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        11. lift-+.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        12. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        13. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im} + y.re \cdot y.re}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        14. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        17. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\color{blue}{y.im \cdot \frac{x.re}{y.re \cdot y.re + y.im \cdot y.im}}\right)\right) \]
      4. Applied rewrites66.2%

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

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

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

          \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re}{y.im}\right)\right)} \]
        3. unsub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
        4. unpow2N/A

          \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
        5. associate-/r*N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
        6. div-subN/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        8. sub-negN/A

          \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + \left(\mathsf{neg}\left(x.re\right)\right)}}{y.im} \]
        9. mul-1-negN/A

          \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + \color{blue}{-1 \cdot x.re}}{y.im} \]
        10. associate-*l/N/A

          \[\leadsto \frac{\color{blue}{\frac{x.im}{y.im} \cdot y.re} + -1 \cdot x.re}{y.im} \]
        11. lower-fma.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}}{y.im} \]
        12. lower-/.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{x.im}{y.im}}, y.re, -1 \cdot x.re\right)}{y.im} \]
        13. mul-1-negN/A

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

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

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

      if 1.3e-62 < y.re < 4.49999999999999999e62

      1. Initial program 92.4%

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

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

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.re \cdot y.re}} \]
        2. lower-*.f6482.0

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.re \cdot y.re}} \]
      5. Applied rewrites82.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -3 \cdot 10^{+133}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq 1.3 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \mathbf{elif}\;y.re \leq 4.5 \cdot 10^{+62}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 79.0% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \mathbf{if}\;y.im \leq -4.5 \cdot 10^{-7}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-13}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (/ (fma (/ x.im y.im) y.re (- x.re)) y.im)))
       (if (<= y.im -4.5e-7)
         t_0
         (if (<= y.im 1.4e-13) (/ (- x.im (/ (* x.re y.im) y.re)) y.re) t_0))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = fma((x_46_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
    	double tmp;
    	if (y_46_im <= -4.5e-7) {
    		tmp = t_0;
    	} else if (y_46_im <= 1.4e-13) {
    		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -4.5e-7)
    		tmp = t_0;
    	elseif (y_46_im <= 1.4e-13)
    		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.5e-7], t$95$0, If[LessEqual[y$46$im, 1.4e-13], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
    \mathbf{if}\;y.im \leq -4.5 \cdot 10^{-7}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-13}:\\
    \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.im < -4.4999999999999998e-7 or 1.4000000000000001e-13 < y.im

      1. Initial program 49.5%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re - x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
        3. div-subN/A

          \[\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}} \]
        4. sub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x.im \cdot y.re}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{y.re \cdot y.re + y.im \cdot y.im} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        7. associate-/l*N/A

          \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        8. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im} \cdot y.re} + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        9. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right)} \]
        10. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{x.im}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        11. lift-+.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        12. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        13. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{y.im \cdot y.im} + y.re \cdot y.re}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        14. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}}, y.re, \mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        16. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\frac{\color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        17. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, y.re, \mathsf{neg}\left(\color{blue}{y.im \cdot \frac{x.re}{y.re \cdot y.re + y.im \cdot y.im}}\right)\right) \]
      4. Applied rewrites55.0%

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

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

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

          \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re}{y.im}\right)\right)} \]
        3. unsub-negN/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
        4. unpow2N/A

          \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
        5. associate-/r*N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
        6. div-subN/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        8. sub-negN/A

          \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + \left(\mathsf{neg}\left(x.re\right)\right)}}{y.im} \]
        9. mul-1-negN/A

          \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + \color{blue}{-1 \cdot x.re}}{y.im} \]
        10. associate-*l/N/A

          \[\leadsto \frac{\color{blue}{\frac{x.im}{y.im} \cdot y.re} + -1 \cdot x.re}{y.im} \]
        11. lower-fma.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}}{y.im} \]
        12. lower-/.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{x.im}{y.im}}, y.re, -1 \cdot x.re\right)}{y.im} \]
        13. mul-1-negN/A

          \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
        14. lower-neg.f6482.2

          \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \color{blue}{-x.re}\right)}{y.im} \]
      7. Applied rewrites82.2%

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

      if -4.4999999999999998e-7 < y.im < 1.4000000000000001e-13

      1. Initial program 79.5%

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

        \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
        2. mul-1-negN/A

          \[\leadsto \frac{x.im + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}}{y.re} \]
        3. unsub-negN/A

          \[\leadsto \frac{\color{blue}{x.im - \frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        4. lower--.f64N/A

          \[\leadsto \frac{\color{blue}{x.im - \frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        5. lower-/.f64N/A

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

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

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

    Alternative 6: 65.2% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -4.5 \cdot 10^{+109}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\ \;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (/ (- x.re) y.im)))
       (if (<= y.im -4.5e+109)
         t_0
         (if (<= y.im -8.6e-106)
           (* (/ y.im (fma y.im y.im (* y.re y.re))) (- x.re))
           (if (<= y.im 4.5e-15) (/ x.im y.re) t_0)))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = -x_46_re / y_46_im;
    	double tmp;
    	if (y_46_im <= -4.5e+109) {
    		tmp = t_0;
    	} else if (y_46_im <= -8.6e-106) {
    		tmp = (y_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * -x_46_re;
    	} else if (y_46_im <= 4.5e-15) {
    		tmp = x_46_im / y_46_re;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(Float64(-x_46_re) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -4.5e+109)
    		tmp = t_0;
    	elseif (y_46_im <= -8.6e-106)
    		tmp = Float64(Float64(y_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * Float64(-x_46_re));
    	elseif (y_46_im <= 4.5e-15)
    		tmp = Float64(x_46_im / y_46_re);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.5e+109], t$95$0, If[LessEqual[y$46$im, -8.6e-106], N[(N[(y$46$im / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-x$46$re)), $MachinePrecision], If[LessEqual[y$46$im, 4.5e-15], N[(x$46$im / y$46$re), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{-x.re}{y.im}\\
    \mathbf{if}\;y.im \leq -4.5 \cdot 10^{+109}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\
    \;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\
    
    \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.im < -4.4999999999999996e109 or 4.4999999999999998e-15 < y.im

      1. Initial program 42.4%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{x.re}{y.im}\right)} \]
        2. distribute-neg-frac2N/A

          \[\leadsto \color{blue}{\frac{x.re}{\mathsf{neg}\left(y.im\right)}} \]
        3. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{-1 \cdot y.im}} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.re}{-1 \cdot y.im}} \]
        5. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
        6. lower-neg.f6466.3

          \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
      5. Applied rewrites66.3%

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

      if -4.4999999999999996e109 < y.im < -8.6000000000000004e-106

      1. Initial program 87.9%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re \cdot y.im}{{y.im}^{2} + {y.re}^{2}}} \]
      4. Step-by-step derivation
        1. associate-/l*N/A

          \[\leadsto -1 \cdot \color{blue}{\left(x.re \cdot \frac{y.im}{{y.im}^{2} + {y.re}^{2}}\right)} \]
        2. associate-*r*N/A

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

          \[\leadsto \color{blue}{\left(-1 \cdot x.re\right) \cdot \frac{y.im}{{y.im}^{2} + {y.re}^{2}}} \]
        4. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x.re\right)\right)} \cdot \frac{y.im}{{y.im}^{2} + {y.re}^{2}} \]
        5. lower-neg.f64N/A

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

          \[\leadsto \left(-x.re\right) \cdot \color{blue}{\frac{y.im}{{y.im}^{2} + {y.re}^{2}}} \]
        7. unpow2N/A

          \[\leadsto \left(-x.re\right) \cdot \frac{y.im}{\color{blue}{y.im \cdot y.im} + {y.re}^{2}} \]
        8. lower-fma.f64N/A

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

          \[\leadsto \left(-x.re\right) \cdot \frac{y.im}{\mathsf{fma}\left(y.im, y.im, \color{blue}{y.re \cdot y.re}\right)} \]
        10. lower-*.f6464.8

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

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

      if -8.6000000000000004e-106 < y.im < 4.4999999999999998e-15

      1. Initial program 77.6%

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f6469.0

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      5. Applied rewrites69.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.5 \cdot 10^{+109}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -8.6 \cdot 10^{-106}:\\ \;\;\;\;\frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(-x.re\right)\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 7: 65.4% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -1.1 \cdot 10^{+133}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.7 \cdot 10^{-84}:\\ \;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.im\\ \mathbf{elif}\;y.re \leq 5.8 \cdot 10^{-57}:\\ \;\;\;\;\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 -1.1e+133)
       (/ x.im y.re)
       (if (<= y.re -1.7e-84)
         (* (/ y.re (fma y.im y.im (* y.re y.re))) x.im)
         (if (<= y.re 5.8e-57) (/ (- 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 <= -1.1e+133) {
    		tmp = x_46_im / y_46_re;
    	} else if (y_46_re <= -1.7e-84) {
    		tmp = (y_46_re / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * x_46_im;
    	} else if (y_46_re <= 5.8e-57) {
    		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 <= -1.1e+133)
    		tmp = Float64(x_46_im / y_46_re);
    	elseif (y_46_re <= -1.7e-84)
    		tmp = Float64(Float64(y_46_re / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * x_46_im);
    	elseif (y_46_re <= 5.8e-57)
    		tmp = Float64(Float64(-x_46_re) / y_46_im);
    	else
    		tmp = Float64(x_46_im / y_46_re);
    	end
    	return tmp
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -1.1e+133], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.7e-84], N[(N[(y$46$re / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision], If[LessEqual[y$46$re, 5.8e-57], 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 -1.1 \cdot 10^{+133}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    \mathbf{elif}\;y.re \leq -1.7 \cdot 10^{-84}:\\
    \;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.im\\
    
    \mathbf{elif}\;y.re \leq 5.8 \cdot 10^{-57}:\\
    \;\;\;\;\frac{-x.re}{y.im}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.re < -1.1e133 or 5.8000000000000005e-57 < y.re

      1. Initial program 53.3%

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f6470.1

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      5. Applied rewrites70.1%

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

      if -1.1e133 < y.re < -1.7000000000000001e-84

      1. Initial program 79.5%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
        2. frac-2negN/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(x.im \cdot y.re - x.re \cdot y.im\right)\right)}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)}} \]
        3. div-invN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(x.im \cdot y.re - x.re \cdot y.im\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)}} \]
        4. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(x.im \cdot y.re - x.re \cdot y.im\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)}} \]
        5. lift--.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(x.im \cdot y.re - x.re \cdot y.im\right)}\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        6. sub-negN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(x.im \cdot y.re + \left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)}\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        7. distribute-neg-inN/A

          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(x.im \cdot y.re\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right)\right)} \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        8. lift-*.f64N/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{x.im \cdot y.re}\right)\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        9. distribute-lft-neg-inN/A

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(x.im\right)\right) \cdot y.re} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        10. remove-double-negN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(x.im\right)\right) \cdot y.re + \color{blue}{x.re \cdot y.im}\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        11. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(x.im\right), y.re, x.re \cdot y.im\right)} \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        12. lower-neg.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{-x.im}, y.re, x.re \cdot y.im\right) \cdot \frac{1}{\mathsf{neg}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right)\right)} \]
        13. neg-mul-1N/A

          \[\leadsto \mathsf{fma}\left(-x.im, y.re, x.re \cdot y.im\right) \cdot \frac{1}{\color{blue}{-1 \cdot \left(y.re \cdot y.re + y.im \cdot y.im\right)}} \]
        14. associate-/r*N/A

          \[\leadsto \mathsf{fma}\left(-x.im, y.re, x.re \cdot y.im\right) \cdot \color{blue}{\frac{\frac{1}{-1}}{y.re \cdot y.re + y.im \cdot y.im}} \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(-x.im, y.re, x.re \cdot y.im\right) \cdot \frac{\color{blue}{-1}}{y.re \cdot y.re + y.im \cdot y.im} \]
        16. lower-/.f6479.5

          \[\leadsto \mathsf{fma}\left(-x.im, y.re, x.re \cdot y.im\right) \cdot \color{blue}{\frac{-1}{y.re \cdot y.re + y.im \cdot y.im}} \]
        17. lift-+.f64N/A

          \[\leadsto \mathsf{fma}\left(-x.im, y.re, x.re \cdot y.im\right) \cdot \frac{-1}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
        18. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(-x.im, y.re, x.re \cdot y.im\right) \cdot \frac{-1}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
        19. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(-x.im, y.re, x.re \cdot y.im\right) \cdot \frac{-1}{\color{blue}{y.im \cdot y.im} + y.re \cdot y.re} \]
        20. lower-fma.f6479.5

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

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

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2} + {y.re}^{2}}} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2} + {y.re}^{2}} \]
        2. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{y.re}{{y.im}^{2} + {y.re}^{2}} \cdot x.im} \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{y.re}{{y.im}^{2} + {y.re}^{2}} \cdot x.im} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{y.re}{{y.im}^{2} + {y.re}^{2}}} \cdot x.im \]
        5. unpow2N/A

          \[\leadsto \frac{y.re}{\color{blue}{y.im \cdot y.im} + {y.re}^{2}} \cdot x.im \]
        6. lower-fma.f64N/A

          \[\leadsto \frac{y.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, {y.re}^{2}\right)}} \cdot x.im \]
        7. unpow2N/A

          \[\leadsto \frac{y.re}{\mathsf{fma}\left(y.im, y.im, \color{blue}{y.re \cdot y.re}\right)} \cdot x.im \]
        8. lower-*.f6454.7

          \[\leadsto \frac{y.re}{\mathsf{fma}\left(y.im, y.im, \color{blue}{y.re \cdot y.re}\right)} \cdot x.im \]
      7. Applied rewrites54.7%

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

      if -1.7000000000000001e-84 < y.re < 5.8000000000000005e-57

      1. Initial program 71.9%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{x.re}{y.im}\right)} \]
        2. distribute-neg-frac2N/A

          \[\leadsto \color{blue}{\frac{x.re}{\mathsf{neg}\left(y.im\right)}} \]
        3. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{-1 \cdot y.im}} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.re}{-1 \cdot y.im}} \]
        5. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
        6. lower-neg.f6467.7

          \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
      5. Applied rewrites67.7%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -1.1 \cdot 10^{+133}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.7 \cdot 10^{-84}:\\ \;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.im\\ \mathbf{elif}\;y.re \leq 5.8 \cdot 10^{-57}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 8: 62.5% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -9 \cdot 10^{-106}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (/ (- x.re) y.im)))
       (if (<= y.im -9e-106) t_0 (if (<= y.im 4.5e-15) (/ x.im y.re) t_0))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = -x_46_re / y_46_im;
    	double tmp;
    	if (y_46_im <= -9e-106) {
    		tmp = t_0;
    	} else if (y_46_im <= 4.5e-15) {
    		tmp = x_46_im / y_46_re;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(x_46re, x_46im, y_46re, y_46im)
        real(8), intent (in) :: x_46re
        real(8), intent (in) :: x_46im
        real(8), intent (in) :: y_46re
        real(8), intent (in) :: y_46im
        real(8) :: t_0
        real(8) :: tmp
        t_0 = -x_46re / y_46im
        if (y_46im <= (-9d-106)) then
            tmp = t_0
        else if (y_46im <= 4.5d-15) then
            tmp = x_46im / y_46re
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = -x_46_re / y_46_im;
    	double tmp;
    	if (y_46_im <= -9e-106) {
    		tmp = t_0;
    	} else if (y_46_im <= 4.5e-15) {
    		tmp = x_46_im / y_46_re;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x_46_re, x_46_im, y_46_re, y_46_im):
    	t_0 = -x_46_re / y_46_im
    	tmp = 0
    	if y_46_im <= -9e-106:
    		tmp = t_0
    	elif y_46_im <= 4.5e-15:
    		tmp = x_46_im / y_46_re
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(Float64(-x_46_re) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -9e-106)
    		tmp = t_0;
    	elseif (y_46_im <= 4.5e-15)
    		tmp = Float64(x_46_im / y_46_re);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = -x_46_re / y_46_im;
    	tmp = 0.0;
    	if (y_46_im <= -9e-106)
    		tmp = t_0;
    	elseif (y_46_im <= 4.5e-15)
    		tmp = x_46_im / y_46_re;
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -9e-106], t$95$0, If[LessEqual[y$46$im, 4.5e-15], N[(x$46$im / y$46$re), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{-x.re}{y.im}\\
    \mathbf{if}\;y.im \leq -9 \cdot 10^{-106}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.im < -8.99999999999999911e-106 or 4.4999999999999998e-15 < y.im

      1. Initial program 55.6%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{x.re}{y.im}\right)} \]
        2. distribute-neg-frac2N/A

          \[\leadsto \color{blue}{\frac{x.re}{\mathsf{neg}\left(y.im\right)}} \]
        3. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{-1 \cdot y.im}} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.re}{-1 \cdot y.im}} \]
        5. mul-1-negN/A

          \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
        6. lower-neg.f6461.2

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

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

      if -8.99999999999999911e-106 < y.im < 4.4999999999999998e-15

      1. Initial program 77.6%

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f6469.0

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      5. Applied rewrites69.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -9 \cdot 10^{-106}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 43.3% accurate, 3.2× 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 65.5%

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

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. lower-/.f6441.5

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    5. Applied rewrites41.5%

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

    Reproduce

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