_divideComplex, imaginary part

Percentage Accurate: 61.7% → 83.4%
Time: 11.1s
Alternatives: 15
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 15 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: 83.4% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y.re \leq -1.85 \cdot 10^{-140}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 36.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6439.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

    if -4.5000000000000003e121 < y.re < -1.84999999999999989e-140 or 4.40000000000000002e-94 < y.re < 5.4999999999999999e59

    1. Initial program 83.0%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.84999999999999989e-140 < y.re < 4.40000000000000002e-94

    1. Initial program 69.9%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6464.0

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6493.8

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
      5. /-lowering-/.f6493.8

        \[\leadsto \frac{\frac{x.im}{\color{blue}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
    9. Applied egg-rr93.8%

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

    if 5.4999999999999999e59 < y.re

    1. Initial program 52.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6459.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6485.0

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, \frac{1}{y.re} \cdot \left(\mathsf{neg}\left(x.re\right)\right), x.im\right)}}{y.re} \]
      5. distribute-rgt-neg-outN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(-1\right)}{y.re}} \cdot x.re\right), x.im\right)}{y.re} \]
      10. metadata-eval85.4

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, -\frac{1}{y.re} \cdot x.re, x.im\right)}}{y.re} \]
    10. Step-by-step derivation
      1. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{y.re}\right)\right) \cdot x.re}, x.im\right)}{y.re} \]
      3. distribute-neg-fracN/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -4.5 \cdot 10^{+121}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -1.85 \cdot 10^{-140}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \frac{x.re \cdot \left(-y.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)\\ \mathbf{elif}\;y.re \leq 4.4 \cdot 10^{-94}:\\ \;\;\;\;\frac{\frac{x.im}{\frac{y.im}{y.re}} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+59}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \frac{x.re \cdot \left(-y.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 82.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)\\ \mathbf{if}\;y.re \leq -1.26 \cdot 10^{+119}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -1.32 \cdot 10^{-169}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.re \leq 8.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{\frac{x.im}{\frac{y.im}{y.re}} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.35 \cdot 10^{+56}:\\ \;\;\;\;\mathsf{fma}\left(-y.im, \frac{x.re}{t\_0}, \frac{y.re \cdot x.im}{t\_0}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (fma y.re y.re (* y.im y.im))))
   (if (<= y.re -1.26e+119)
     (/ (fma (- x.re) (/ y.im y.re) x.im) y.re)
     (if (<= y.re -1.32e-169)
       (/ (- (* y.re x.im) (* x.re y.im)) (+ (* y.im y.im) (* y.re y.re)))
       (if (<= y.re 8.6e-109)
         (/ (- (/ x.im (/ y.im y.re)) x.re) y.im)
         (if (<= y.re 1.35e+56)
           (fma (- y.im) (/ x.re t_0) (/ (* y.re x.im) t_0))
           (/ (fma y.im (* x.re (/ -1.0 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 t_0 = fma(y_46_re, y_46_re, (y_46_im * y_46_im));
	double tmp;
	if (y_46_re <= -1.26e+119) {
		tmp = fma(-x_46_re, (y_46_im / y_46_re), x_46_im) / y_46_re;
	} else if (y_46_re <= -1.32e-169) {
		tmp = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	} else if (y_46_re <= 8.6e-109) {
		tmp = ((x_46_im / (y_46_im / y_46_re)) - x_46_re) / y_46_im;
	} else if (y_46_re <= 1.35e+56) {
		tmp = fma(-y_46_im, (x_46_re / t_0), ((y_46_re * x_46_im) / t_0));
	} else {
		tmp = fma(y_46_im, (x_46_re * (-1.0 / y_46_re)), x_46_im) / y_46_re;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))
	tmp = 0.0
	if (y_46_re <= -1.26e+119)
		tmp = Float64(fma(Float64(-x_46_re), Float64(y_46_im / y_46_re), x_46_im) / y_46_re);
	elseif (y_46_re <= -1.32e-169)
		tmp = 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)));
	elseif (y_46_re <= 8.6e-109)
		tmp = Float64(Float64(Float64(x_46_im / Float64(y_46_im / y_46_re)) - x_46_re) / y_46_im);
	elseif (y_46_re <= 1.35e+56)
		tmp = fma(Float64(-y_46_im), Float64(x_46_re / t_0), Float64(Float64(y_46_re * x_46_im) / t_0));
	else
		tmp = Float64(fma(y_46_im, Float64(x_46_re * Float64(-1.0 / y_46_re)), x_46_im) / y_46_re);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.26e+119], N[(N[((-x$46$re) * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.32e-169], 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], If[LessEqual[y$46$re, 8.6e-109], N[(N[(N[(x$46$im / N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.35e+56], N[((-y$46$im) * N[(x$46$re / t$95$0), $MachinePrecision] + N[(N[(y$46$re * x$46$im), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(y$46$im * N[(x$46$re * N[(-1.0 / y$46$re), $MachinePrecision]), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -1.26e119

    1. Initial program 36.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6439.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

    if -1.26e119 < y.re < -1.32000000000000001e-169

    1. Initial program 87.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 -1.32000000000000001e-169 < y.re < 8.5999999999999993e-109

    1. Initial program 68.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6461.8

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6493.2

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
      5. /-lowering-/.f6493.3

        \[\leadsto \frac{\frac{x.im}{\color{blue}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
    9. Applied egg-rr93.3%

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

    if 8.5999999999999993e-109 < y.re < 1.35000000000000005e56

    1. Initial program 74.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(y.im\right), \frac{x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, \frac{y.re \cdot x.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      16. *-lowering-*.f6478.5

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

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

    if 1.35000000000000005e56 < y.re

    1. Initial program 52.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6459.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6485.0

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, \frac{1}{y.re} \cdot \left(\mathsf{neg}\left(x.re\right)\right), x.im\right)}}{y.re} \]
      5. distribute-rgt-neg-outN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(-1\right)}{y.re}} \cdot x.re\right), x.im\right)}{y.re} \]
      10. metadata-eval85.4

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, -\frac{1}{y.re} \cdot x.re, x.im\right)}}{y.re} \]
    10. Step-by-step derivation
      1. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{y.re}\right)\right) \cdot x.re}, x.im\right)}{y.re} \]
      3. distribute-neg-fracN/A

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

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

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

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

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

Alternative 3: 82.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot x.im - x.re \cdot y.im\\ \mathbf{if}\;y.re \leq -3.2 \cdot 10^{+119}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -1.32 \cdot 10^{-169}:\\ \;\;\;\;\frac{t\_0}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.re \leq 1.1 \cdot 10^{-92}:\\ \;\;\;\;\frac{\frac{x.im}{\frac{y.im}{y.re}} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.7 \cdot 10^{+55}:\\ \;\;\;\;\frac{t\_0}{\frac{1}{\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\ \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))))
   (if (<= y.re -3.2e+119)
     (/ (fma (- x.re) (/ y.im y.re) x.im) y.re)
     (if (<= y.re -1.32e-169)
       (/ t_0 (+ (* y.im y.im) (* y.re y.re)))
       (if (<= y.re 1.1e-92)
         (/ (- (/ x.im (/ y.im y.re)) x.re) y.im)
         (if (<= y.re 1.7e+55)
           (/ t_0 (/ 1.0 (/ 1.0 (fma y.re y.re (* y.im y.im)))))
           (/ (fma y.im (* x.re (/ -1.0 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 t_0 = (y_46_re * x_46_im) - (x_46_re * y_46_im);
	double tmp;
	if (y_46_re <= -3.2e+119) {
		tmp = fma(-x_46_re, (y_46_im / y_46_re), x_46_im) / y_46_re;
	} else if (y_46_re <= -1.32e-169) {
		tmp = t_0 / ((y_46_im * y_46_im) + (y_46_re * y_46_re));
	} else if (y_46_re <= 1.1e-92) {
		tmp = ((x_46_im / (y_46_im / y_46_re)) - x_46_re) / y_46_im;
	} else if (y_46_re <= 1.7e+55) {
		tmp = t_0 / (1.0 / (1.0 / fma(y_46_re, y_46_re, (y_46_im * y_46_im))));
	} else {
		tmp = fma(y_46_im, (x_46_re * (-1.0 / y_46_re)), x_46_im) / 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 * x_46_im) - Float64(x_46_re * y_46_im))
	tmp = 0.0
	if (y_46_re <= -3.2e+119)
		tmp = Float64(fma(Float64(-x_46_re), Float64(y_46_im / y_46_re), x_46_im) / y_46_re);
	elseif (y_46_re <= -1.32e-169)
		tmp = Float64(t_0 / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re)));
	elseif (y_46_re <= 1.1e-92)
		tmp = Float64(Float64(Float64(x_46_im / Float64(y_46_im / y_46_re)) - x_46_re) / y_46_im);
	elseif (y_46_re <= 1.7e+55)
		tmp = Float64(t_0 / Float64(1.0 / Float64(1.0 / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im)))));
	else
		tmp = Float64(fma(y_46_im, Float64(x_46_re * Float64(-1.0 / y_46_re)), x_46_im) / y_46_re);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -3.2e+119], N[(N[((-x$46$re) * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.32e-169], N[(t$95$0 / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.1e-92], N[(N[(N[(x$46$im / N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.7e+55], N[(t$95$0 / N[(1.0 / N[(1.0 / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y$46$im * N[(x$46$re * N[(-1.0 / y$46$re), $MachinePrecision]), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq -1.32 \cdot 10^{-169}:\\
\;\;\;\;\frac{t\_0}{y.im \cdot y.im + y.re \cdot y.re}\\

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

\mathbf{elif}\;y.re \leq 1.7 \cdot 10^{+55}:\\
\;\;\;\;\frac{t\_0}{\frac{1}{\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -3.19999999999999989e119

    1. Initial program 36.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6439.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

    if -3.19999999999999989e119 < y.re < -1.32000000000000001e-169

    1. Initial program 87.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 -1.32000000000000001e-169 < y.re < 1.09999999999999994e-92

    1. Initial program 68.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6493.6

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
      5. /-lowering-/.f6493.6

        \[\leadsto \frac{\frac{x.im}{\color{blue}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
    9. Applied egg-rr93.6%

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

    if 1.09999999999999994e-92 < y.re < 1.6999999999999999e55

    1. Initial program 74.6%

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

        \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{\frac{\left(y.re \cdot y.re\right) \cdot \left(y.re \cdot y.re\right) - \left(y.im \cdot y.im\right) \cdot \left(y.im \cdot y.im\right)}{y.re \cdot y.re - y.im \cdot y.im}}} \]
      2. clear-numN/A

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

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

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

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

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

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

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

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

    if 1.6999999999999999e55 < y.re

    1. Initial program 52.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6459.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6485.0

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, \frac{1}{y.re} \cdot \left(\mathsf{neg}\left(x.re\right)\right), x.im\right)}}{y.re} \]
      5. distribute-rgt-neg-outN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(-1\right)}{y.re}} \cdot x.re\right), x.im\right)}{y.re} \]
      10. metadata-eval85.4

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, -\frac{1}{y.re} \cdot x.re, x.im\right)}}{y.re} \]
    10. Step-by-step derivation
      1. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{y.re}\right)\right) \cdot x.re}, x.im\right)}{y.re} \]
      3. distribute-neg-fracN/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -3.2 \cdot 10^{+119}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -1.32 \cdot 10^{-169}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.re \leq 1.1 \cdot 10^{-92}:\\ \;\;\;\;\frac{\frac{x.im}{\frac{y.im}{y.re}} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.7 \cdot 10^{+55}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{\frac{1}{\frac{1}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 82.5% 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}\\ \mathbf{if}\;y.re \leq -6.8 \cdot 10^{+118}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -1.32 \cdot 10^{-169}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 7.2 \cdot 10^{-96}:\\ \;\;\;\;\frac{\frac{x.im}{\frac{y.im}{y.re}} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+59}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\ \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)))))
   (if (<= y.re -6.8e+118)
     (/ (fma (- x.re) (/ y.im y.re) x.im) y.re)
     (if (<= y.re -1.32e-169)
       t_0
       (if (<= y.re 7.2e-96)
         (/ (- (/ x.im (/ y.im y.re)) x.re) y.im)
         (if (<= y.re 5.5e+59)
           t_0
           (/ (fma y.im (* x.re (/ -1.0 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 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 tmp;
	if (y_46_re <= -6.8e+118) {
		tmp = fma(-x_46_re, (y_46_im / y_46_re), x_46_im) / y_46_re;
	} else if (y_46_re <= -1.32e-169) {
		tmp = t_0;
	} else if (y_46_re <= 7.2e-96) {
		tmp = ((x_46_im / (y_46_im / y_46_re)) - x_46_re) / y_46_im;
	} else if (y_46_re <= 5.5e+59) {
		tmp = t_0;
	} else {
		tmp = fma(y_46_im, (x_46_re * (-1.0 / y_46_re)), x_46_im) / y_46_re;
	}
	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)))
	tmp = 0.0
	if (y_46_re <= -6.8e+118)
		tmp = Float64(fma(Float64(-x_46_re), Float64(y_46_im / y_46_re), x_46_im) / y_46_re);
	elseif (y_46_re <= -1.32e-169)
		tmp = t_0;
	elseif (y_46_re <= 7.2e-96)
		tmp = Float64(Float64(Float64(x_46_im / Float64(y_46_im / y_46_re)) - x_46_re) / y_46_im);
	elseif (y_46_re <= 5.5e+59)
		tmp = t_0;
	else
		tmp = Float64(fma(y_46_im, Float64(x_46_re * Float64(-1.0 / y_46_re)), x_46_im) / y_46_re);
	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]}, If[LessEqual[y$46$re, -6.8e+118], N[(N[((-x$46$re) * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.32e-169], t$95$0, If[LessEqual[y$46$re, 7.2e-96], N[(N[(N[(x$46$im / N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 5.5e+59], t$95$0, N[(N[(y$46$im * N[(x$46$re * N[(-1.0 / y$46$re), $MachinePrecision]), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $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}\\
\mathbf{if}\;y.re \leq -6.8 \cdot 10^{+118}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\

\mathbf{elif}\;y.re \leq -1.32 \cdot 10^{-169}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+59}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 36.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6439.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

    if -6.79999999999999973e118 < y.re < -1.32000000000000001e-169 or 7.20000000000000016e-96 < y.re < 5.4999999999999999e59

    1. Initial program 83.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 -1.32000000000000001e-169 < y.re < 7.20000000000000016e-96

    1. Initial program 68.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6493.6

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
      5. /-lowering-/.f6493.6

        \[\leadsto \frac{\frac{x.im}{\color{blue}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
    9. Applied egg-rr93.6%

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

    if 5.4999999999999999e59 < y.re

    1. Initial program 52.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6459.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6485.0

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, \frac{1}{y.re} \cdot \left(\mathsf{neg}\left(x.re\right)\right), x.im\right)}}{y.re} \]
      5. distribute-rgt-neg-outN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(-1\right)}{y.re}} \cdot x.re\right), x.im\right)}{y.re} \]
      10. metadata-eval85.4

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, -\frac{1}{y.re} \cdot x.re, x.im\right)}}{y.re} \]
    10. Step-by-step derivation
      1. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{y.re}\right)\right) \cdot x.re}, x.im\right)}{y.re} \]
      3. distribute-neg-fracN/A

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -6.8 \cdot 10^{+118}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -1.32 \cdot 10^{-169}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.re \leq 7.2 \cdot 10^{-96}:\\ \;\;\;\;\frac{\frac{x.im}{\frac{y.im}{y.re}} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+59}:\\ \;\;\;\;\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(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 64.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot x.im - x.re \cdot y.im\\ \mathbf{if}\;y.re \leq -0.215:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -3.8 \cdot 10^{-248}:\\ \;\;\;\;\frac{t\_0}{y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 0.0037:\\ \;\;\;\;-\frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 9.8 \cdot 10^{+113}:\\ \;\;\;\;\frac{t\_0}{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
 (let* ((t_0 (- (* y.re x.im) (* x.re y.im))))
   (if (<= y.re -0.215)
     (/ x.im y.re)
     (if (<= y.re -3.8e-248)
       (/ t_0 (* y.im y.im))
       (if (<= y.re 0.0037)
         (- (/ x.re y.im))
         (if (<= y.re 9.8e+113) (/ t_0 (* 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 t_0 = (y_46_re * x_46_im) - (x_46_re * y_46_im);
	double tmp;
	if (y_46_re <= -0.215) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -3.8e-248) {
		tmp = t_0 / (y_46_im * y_46_im);
	} else if (y_46_re <= 0.0037) {
		tmp = -(x_46_re / y_46_im);
	} else if (y_46_re <= 9.8e+113) {
		tmp = t_0 / (y_46_re * y_46_re);
	} 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) :: t_0
    real(8) :: tmp
    t_0 = (y_46re * x_46im) - (x_46re * y_46im)
    if (y_46re <= (-0.215d0)) then
        tmp = x_46im / y_46re
    else if (y_46re <= (-3.8d-248)) then
        tmp = t_0 / (y_46im * y_46im)
    else if (y_46re <= 0.0037d0) then
        tmp = -(x_46re / y_46im)
    else if (y_46re <= 9.8d+113) then
        tmp = t_0 / (y_46re * y_46re)
    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 t_0 = (y_46_re * x_46_im) - (x_46_re * y_46_im);
	double tmp;
	if (y_46_re <= -0.215) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -3.8e-248) {
		tmp = t_0 / (y_46_im * y_46_im);
	} else if (y_46_re <= 0.0037) {
		tmp = -(x_46_re / y_46_im);
	} else if (y_46_re <= 9.8e+113) {
		tmp = t_0 / (y_46_re * y_46_re);
	} else {
		tmp = x_46_im / 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) - (x_46_re * y_46_im)
	tmp = 0
	if y_46_re <= -0.215:
		tmp = x_46_im / y_46_re
	elif y_46_re <= -3.8e-248:
		tmp = t_0 / (y_46_im * y_46_im)
	elif y_46_re <= 0.0037:
		tmp = -(x_46_re / y_46_im)
	elif y_46_re <= 9.8e+113:
		tmp = t_0 / (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)
	t_0 = Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im))
	tmp = 0.0
	if (y_46_re <= -0.215)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= -3.8e-248)
		tmp = Float64(t_0 / Float64(y_46_im * y_46_im));
	elseif (y_46_re <= 0.0037)
		tmp = Float64(-Float64(x_46_re / y_46_im));
	elseif (y_46_re <= 9.8e+113)
		tmp = Float64(t_0 / Float64(y_46_re * y_46_re));
	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)
	t_0 = (y_46_re * x_46_im) - (x_46_re * y_46_im);
	tmp = 0.0;
	if (y_46_re <= -0.215)
		tmp = x_46_im / y_46_re;
	elseif (y_46_re <= -3.8e-248)
		tmp = t_0 / (y_46_im * y_46_im);
	elseif (y_46_re <= 0.0037)
		tmp = -(x_46_re / y_46_im);
	elseif (y_46_re <= 9.8e+113)
		tmp = t_0 / (y_46_re * y_46_re);
	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_] := Block[{t$95$0 = N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -0.215], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -3.8e-248], N[(t$95$0 / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 0.0037], (-N[(x$46$re / y$46$im), $MachinePrecision]), If[LessEqual[y$46$re, 9.8e+113], N[(t$95$0 / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq -3.8 \cdot 10^{-248}:\\
\;\;\;\;\frac{t\_0}{y.im \cdot y.im}\\

\mathbf{elif}\;y.re \leq 0.0037:\\
\;\;\;\;-\frac{x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 9.8 \cdot 10^{+113}:\\
\;\;\;\;\frac{t\_0}{y.re \cdot y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -0.214999999999999997 or 9.80000000000000043e113 < y.re

    1. Initial program 48.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. /-lowering-/.f6474.1

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

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

    if -0.214999999999999997 < y.re < -3.7999999999999999e-248

    1. Initial program 89.1%

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

      \[\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. *-lowering-*.f6474.7

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

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

    if -3.7999999999999999e-248 < y.re < 0.0037000000000000002

    1. Initial program 66.4%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around 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. /-lowering-/.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. neg-lowering-neg.f6473.8

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

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

    if 0.0037000000000000002 < y.re < 9.80000000000000043e113

    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 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. *-lowering-*.f6480.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -0.215:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -3.8 \cdot 10^{-248}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 0.0037:\\ \;\;\;\;-\frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 9.8 \cdot 10^{+113}:\\ \;\;\;\;\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 6: 78.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\
\mathbf{if}\;y.re \leq -0.32:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -0.320000000000000007 or 2.59999999999999987e-30 < y.re

    1. Initial program 56.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6461.5

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6480.2

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, \frac{1}{y.re} \cdot \left(\mathsf{neg}\left(x.re\right)\right), x.im\right)}}{y.re} \]
      5. distribute-rgt-neg-outN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(-1\right)}{y.re}} \cdot x.re\right), x.im\right)}{y.re} \]
      10. metadata-eval81.0

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, -\frac{1}{y.re} \cdot x.re, x.im\right)}}{y.re} \]
    10. Step-by-step derivation
      1. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{y.re}\right)\right) \cdot x.re}, x.im\right)}{y.re} \]
      3. distribute-neg-fracN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \frac{\color{blue}{-1}}{y.re} \cdot x.re, x.im\right)}{y.re} \]
      5. /-lowering-/.f6481.0

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

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

    if -0.320000000000000007 < y.re < 2.59999999999999987e-30

    1. Initial program 74.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6470.8

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6485.2

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im}{\frac{y.im}{y.re}}} - x.re}{y.im} \]
      5. /-lowering-/.f6485.2

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

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

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

Alternative 7: 78.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.im, x.re \cdot \frac{-1}{y.re}, x.im\right)}{y.re}\\
\mathbf{if}\;y.re \leq -0.46:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -0.46000000000000002 or 2.29999999999999984e-30 < y.re

    1. Initial program 56.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6461.5

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6480.2

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, \frac{1}{y.re} \cdot \left(\mathsf{neg}\left(x.re\right)\right), x.im\right)}}{y.re} \]
      5. distribute-rgt-neg-outN/A

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \mathsf{neg}\left(\color{blue}{\frac{\mathsf{neg}\left(-1\right)}{y.re}} \cdot x.re\right), x.im\right)}{y.re} \]
      10. metadata-eval81.0

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.im, -\frac{1}{y.re} \cdot x.re, x.im\right)}}{y.re} \]
    10. Step-by-step derivation
      1. distribute-lft-neg-inN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{y.re}\right)\right) \cdot x.re}, x.im\right)}{y.re} \]
      3. distribute-neg-fracN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(y.im, \frac{\color{blue}{-1}}{y.re} \cdot x.re, x.im\right)}{y.re} \]
      5. /-lowering-/.f6481.0

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

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

    if -0.46000000000000002 < y.re < 2.29999999999999984e-30

    1. Initial program 74.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6470.8

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6485.2

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    8. Step-by-step derivation
      1. 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} \]
      2. associate-/l*N/A

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

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

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

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

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

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

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

Alternative 8: 78.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\
\mathbf{if}\;y.re \leq -0.32:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -0.320000000000000007 or 2.39999999999999985e-30 < y.re

    1. Initial program 56.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6461.5

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6480.2

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

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

    if -0.320000000000000007 < y.re < 2.39999999999999985e-30

    1. Initial program 74.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6470.8

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6485.2

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    8. Step-by-step derivation
      1. 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} \]
      2. associate-/l*N/A

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

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

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

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

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

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

Alternative 9: 78.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}\\
\mathbf{if}\;y.re \leq -0.75:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -0.75 or 2.29999999999999984e-30 < y.re

    1. Initial program 56.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. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6461.5

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, -\frac{y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)} \]
    5. 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}} \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(x.re\right)}, \frac{y.im}{y.re}, x.im\right)}{y.re} \]
      8. /-lowering-/.f6480.2

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

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

    if -0.75 < y.re < 2.29999999999999984e-30

    1. Initial program 74.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, x.im, \mathsf{neg}\left(\frac{y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right)\right) \]
      14. *-lowering-*.f6470.8

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6485.2

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

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

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

Alternative 10: 76.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -0.35:\\
\;\;\;\;t\_0\\

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

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


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

    1. Initial program 55.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. 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. /-lowering-/.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. --lowering--.f64N/A

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

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

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

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

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

    if -0.34999999999999998 < y.re < 9.00000000000000023e-6

    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. Add Preprocessing
    3. Step-by-step derivation
      1. 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}} \]
      2. 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)} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{x.im \cdot \frac{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) \]
      4. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
    6. Step-by-step derivation
      1. 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} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im}} - x.re}{y.im} \]
      10. *-lowering-*.f6484.6

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

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

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

Alternative 11: 72.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 5.4 \cdot 10^{+66}:\\ \;\;\;\;\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 (- (/ x.re y.im))))
   (if (<= y.im -4.8e+91)
     t_0
     (if (<= y.im 5.4e+66) (/ (- 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 = -(x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = t_0;
	} else if (y_46_im <= 5.4e+66) {
		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -(x_46re / y_46im)
    if (y_46im <= (-4.8d+91)) then
        tmp = t_0
    else if (y_46im <= 5.4d+66) then
        tmp = (x_46im - ((x_46re * y_46im) / y_46re)) / y_46re
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = -(x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -4.8e+91) {
		tmp = t_0;
	} else if (y_46_im <= 5.4e+66) {
		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = -(x_46_re / y_46_im)
	tmp = 0
	if y_46_im <= -4.8e+91:
		tmp = t_0
	elif y_46_im <= 5.4e+66:
		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(-Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -4.8e+91)
		tmp = t_0;
	elseif (y_46_im <= 5.4e+66)
		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
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 <= -4.8e+91)
		tmp = t_0;
	elseif (y_46_im <= 5.4e+66)
		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = (-N[(x$46$re / y$46$im), $MachinePrecision])}, If[LessEqual[y$46$im, -4.8e+91], t$95$0, If[LessEqual[y$46$im, 5.4e+66], 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{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.im \leq 5.4 \cdot 10^{+66}:\\
\;\;\;\;\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.79999999999999966e91 or 5.4e66 < y.im

    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. 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. /-lowering-/.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. neg-lowering-neg.f6477.2

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

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

    if -4.79999999999999966e91 < y.im < 5.4e66

    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. 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. /-lowering-/.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. --lowering--.f64N/A

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

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

        \[\leadsto \frac{x.im - \frac{\color{blue}{y.im \cdot x.re}}{y.re}}{y.re} \]
      7. *-lowering-*.f6477.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.8 \cdot 10^{+91}:\\ \;\;\;\;-\frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 5.4 \cdot 10^{+66}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;-\frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 63.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -0.145:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -4.2 \cdot 10^{-248}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 7.2 \cdot 10^{+49}:\\ \;\;\;\;-\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 -0.145)
   (/ x.im y.re)
   (if (<= y.re -4.2e-248)
     (/ (- (* y.re x.im) (* x.re y.im)) (* y.im y.im))
     (if (<= y.re 7.2e+49) (- (/ 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 <= -0.145) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -4.2e-248) {
		tmp = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_im * y_46_im);
	} else if (y_46_re <= 7.2e+49) {
		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 <= (-0.145d0)) then
        tmp = x_46im / y_46re
    else if (y_46re <= (-4.2d-248)) then
        tmp = ((y_46re * x_46im) - (x_46re * y_46im)) / (y_46im * y_46im)
    else if (y_46re <= 7.2d+49) 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 <= -0.145) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -4.2e-248) {
		tmp = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_im * y_46_im);
	} else if (y_46_re <= 7.2e+49) {
		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 <= -0.145:
		tmp = x_46_im / y_46_re
	elif y_46_re <= -4.2e-248:
		tmp = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_im * y_46_im)
	elif y_46_re <= 7.2e+49:
		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 <= -0.145)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= -4.2e-248)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(x_46_re * y_46_im)) / Float64(y_46_im * y_46_im));
	elseif (y_46_re <= 7.2e+49)
		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 <= -0.145)
		tmp = x_46_im / y_46_re;
	elseif (y_46_re <= -4.2e-248)
		tmp = ((y_46_re * x_46_im) - (x_46_re * y_46_im)) / (y_46_im * y_46_im);
	elseif (y_46_re <= 7.2e+49)
		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, -0.145], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -4.2e-248], 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$re, 7.2e+49], (-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 -0.145:\\
\;\;\;\;\frac{x.im}{y.re}\\

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

\mathbf{elif}\;y.re \leq 7.2 \cdot 10^{+49}:\\
\;\;\;\;-\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 < -0.14499999999999999 or 7.19999999999999993e49 < y.re

    1. Initial program 53.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 inf

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

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

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

    if -0.14499999999999999 < y.re < -4.2e-248

    1. Initial program 89.1%

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

      \[\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. *-lowering-*.f6474.7

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

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

    if -4.2e-248 < y.re < 7.19999999999999993e49

    1. Initial program 67.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 \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. /-lowering-/.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. neg-lowering-neg.f6470.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -0.145:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -4.2 \cdot 10^{-248}:\\ \;\;\;\;\frac{y.re \cdot x.im - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 7.2 \cdot 10^{+49}:\\ \;\;\;\;-\frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 64.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.15 \cdot 10^{+123}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -3.6 \cdot 10^{-78}:\\ \;\;\;\;\frac{y.re \cdot x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\ \mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+45}:\\ \;\;\;\;-\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.15e+123)
   (/ x.im y.re)
   (if (<= y.re -3.6e-78)
     (/ (* y.re x.im) (fma y.im y.im (* y.re y.re)))
     (if (<= y.re 5.5e+45) (- (/ 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.15e+123) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -3.6e-78) {
		tmp = (y_46_re * x_46_im) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	} else if (y_46_re <= 5.5e+45) {
		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.15e+123)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= -3.6e-78)
		tmp = Float64(Float64(y_46_re * x_46_im) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)));
	elseif (y_46_re <= 5.5e+45)
		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, -2.15e+123], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -3.6e-78], N[(N[(y$46$re * x$46$im), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 5.5e+45], (-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.15 \cdot 10^{+123}:\\
\;\;\;\;\frac{x.im}{y.re}\\

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

\mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+45}:\\
\;\;\;\;-\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 < -2.14999999999999993e123 or 5.5000000000000001e45 < y.re

    1. Initial program 46.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 \color{blue}{\frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6477.8

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

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

    if -2.14999999999999993e123 < y.re < -3.6000000000000002e-78

    1. Initial program 84.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 x.im around inf

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

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

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

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

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

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

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

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

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

    if -3.6000000000000002e-78 < y.re < 5.5000000000000001e45

    1. Initial program 72.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 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. /-lowering-/.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. neg-lowering-neg.f6468.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.15 \cdot 10^{+123}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -3.6 \cdot 10^{-78}:\\ \;\;\;\;\frac{y.re \cdot x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\ \mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+45}:\\ \;\;\;\;-\frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 64.2% accurate, 1.5× speedup?

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

\mathbf{elif}\;y.re \leq 3.4 \cdot 10^{+53}:\\
\;\;\;\;-\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 < -0.450000000000000011 or 3.39999999999999998e53 < y.re

    1. Initial program 54.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. /-lowering-/.f6474.1

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

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

    if -0.450000000000000011 < y.re < 3.39999999999999998e53

    1. Initial program 74.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. /-lowering-/.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. neg-lowering-neg.f6464.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -0.45:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq 3.4 \cdot 10^{+53}:\\ \;\;\;\;-\frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 42.8% 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 64.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. /-lowering-/.f6447.4

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

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

Reproduce

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