_divideComplex, real part

Percentage Accurate: 61.8% → 85.3%
Time: 11.7s
Alternatives: 8
Speedup: 1.6×

Specification

?
\[\begin{array}{l} \\ \frac{x.re \cdot y.re + x.im \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.re y.re) (* x.im 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_re * y_46_re) + (x_46_im * 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_46re * y_46re) + (x_46im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + Float64(x_46_im * 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_re * y_46_re) + (x_46_im * 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$re * y$46$re), $MachinePrecision] + N[(x$46$im * 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.re \cdot y.re + x.im \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 8 alternatives:

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

Initial Program: 61.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x.re \cdot y.re + x.im \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.re y.re) (* x.im 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_re * y_46_re) + (x_46_im * 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_46re * y_46re) + (x_46im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + (x_46_im * 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_re * y_46_re) + Float64(x_46_im * 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_re * y_46_re) + (x_46_im * 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$re * y$46$re), $MachinePrecision] + N[(x$46$im * 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.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}

Alternative 1: 85.3% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;x.re \leq 52000000000:\\
\;\;\;\;\frac{-1}{\mathsf{fma}\left(y.re \cdot \frac{-1}{t\_0}, y.re, -\frac{y.im}{x.im}\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.re < -4.30000000000000002e-23 or 5.2e10 < x.re

    1. Initial program 56.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.30000000000000002e-23 < x.re < 5.2e10

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 82.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{if}\;y.re \leq -8 \cdot 10^{+150}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -5.5 \cdot 10^{-62}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 9.4 \cdot 10^{-94}:\\ \;\;\;\;\frac{x.im + \frac{\mathsf{fma}\left(x.im, \frac{y.re \cdot \left(-y.re\right)}{y.im}, x.re \cdot y.re\right)}{y.im}}{y.im}\\ \mathbf{elif}\;y.re \leq 5.9 \cdot 10^{+119}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (fma x.re y.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))))
   (if (<= y.re -8e+150)
     (/ (fma (/ x.im y.re) y.im x.re) y.re)
     (if (<= y.re -5.5e-62)
       t_0
       (if (<= y.re 9.4e-94)
         (/
          (+ x.im (/ (fma x.im (/ (* y.re (- y.re)) y.im) (* x.re y.re)) y.im))
          y.im)
         (if (<= y.re 5.9e+119)
           t_0
           (/ (fma x.im (/ y.im y.re) x.re) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma(x_46_re, y_46_re, (y_46_im * x_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
	double tmp;
	if (y_46_re <= -8e+150) {
		tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
	} else if (y_46_re <= -5.5e-62) {
		tmp = t_0;
	} else if (y_46_re <= 9.4e-94) {
		tmp = (x_46_im + (fma(x_46_im, ((y_46_re * -y_46_re) / y_46_im), (x_46_re * y_46_re)) / y_46_im)) / y_46_im;
	} else if (y_46_re <= 5.9e+119) {
		tmp = t_0;
	} else {
		tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(fma(x_46_re, y_46_re, Float64(y_46_im * x_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im)))
	tmp = 0.0
	if (y_46_re <= -8e+150)
		tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re);
	elseif (y_46_re <= -5.5e-62)
		tmp = t_0;
	elseif (y_46_re <= 9.4e-94)
		tmp = Float64(Float64(x_46_im + Float64(fma(x_46_im, Float64(Float64(y_46_re * Float64(-y_46_re)) / y_46_im), Float64(x_46_re * y_46_re)) / y_46_im)) / y_46_im);
	elseif (y_46_re <= 5.9e+119)
		tmp = t_0;
	else
		tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / 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[(x$46$re * y$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -8e+150], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -5.5e-62], t$95$0, If[LessEqual[y$46$re, 9.4e-94], N[(N[(x$46$im + N[(N[(x$46$im * N[(N[(y$46$re * (-y$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision] + N[(x$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 5.9e+119], t$95$0, N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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


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

    1. Initial program 27.9%

      \[\frac{x.re \cdot y.re + x.im \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.re + \frac{x.im \cdot y.im}{y.re}}{y.re}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

      if -7.99999999999999985e150 < y.re < -5.50000000000000022e-62 or 9.40000000000000007e-94 < y.re < 5.9000000000000001e119

      1. Initial program 79.4%

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

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

          \[\leadsto \frac{\color{blue}{x.re \cdot y.re} + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
        3. lower-fma.f6479.4

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

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

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

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

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

      if -5.50000000000000022e-62 < y.re < 9.40000000000000007e-94

      1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 5.9000000000000001e119 < y.re

      1. Initial program 33.0%

        \[\frac{x.re \cdot y.re + x.im \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.re + \frac{x.im \cdot y.im}{y.re}}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -8 \cdot 10^{+150}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -5.5 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{elif}\;y.re \leq 9.4 \cdot 10^{-94}:\\ \;\;\;\;\frac{x.im + \frac{\mathsf{fma}\left(x.im, \frac{y.re \cdot \left(-y.re\right)}{y.im}, x.re \cdot y.re\right)}{y.im}}{y.im}\\ \mathbf{elif}\;y.re \leq 5.9 \cdot 10^{+119}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 82.3% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{if}\;y.re \leq -8 \cdot 10^{+150}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -2.35 \cdot 10^{-66}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 9.4 \cdot 10^{-94}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\ \mathbf{elif}\;y.re \leq 5.9 \cdot 10^{+119}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (/ (fma x.re y.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))))
       (if (<= y.re -8e+150)
         (/ (fma (/ x.im y.re) y.im x.re) y.re)
         (if (<= y.re -2.35e-66)
           t_0
           (if (<= y.re 9.4e-94)
             (/ (fma x.re (/ y.re y.im) x.im) y.im)
             (if (<= y.re 5.9e+119)
               t_0
               (/ (fma x.im (/ y.im y.re) x.re) y.re)))))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = fma(x_46_re, y_46_re, (y_46_im * x_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
    	double tmp;
    	if (y_46_re <= -8e+150) {
    		tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
    	} else if (y_46_re <= -2.35e-66) {
    		tmp = t_0;
    	} else if (y_46_re <= 9.4e-94) {
    		tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
    	} else if (y_46_re <= 5.9e+119) {
    		tmp = t_0;
    	} else {
    		tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(fma(x_46_re, y_46_re, Float64(y_46_im * x_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im)))
    	tmp = 0.0
    	if (y_46_re <= -8e+150)
    		tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re);
    	elseif (y_46_re <= -2.35e-66)
    		tmp = t_0;
    	elseif (y_46_re <= 9.4e-94)
    		tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im);
    	elseif (y_46_re <= 5.9e+119)
    		tmp = t_0;
    	else
    		tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / 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[(x$46$re * y$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -8e+150], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -2.35e-66], t$95$0, If[LessEqual[y$46$re, 9.4e-94], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 5.9e+119], t$95$0, N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
    \mathbf{if}\;y.re \leq -8 \cdot 10^{+150}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
    
    \mathbf{elif}\;y.re \leq -2.35 \cdot 10^{-66}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.re \leq 9.4 \cdot 10^{-94}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
    
    \mathbf{elif}\;y.re \leq 5.9 \cdot 10^{+119}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if y.re < -7.99999999999999985e150

      1. Initial program 27.9%

        \[\frac{x.re \cdot y.re + x.im \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.re + \frac{x.im \cdot y.im}{y.re}}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

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

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

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

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

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

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

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

        if -7.99999999999999985e150 < y.re < -2.35e-66 or 9.40000000000000007e-94 < y.re < 5.9000000000000001e119

        1. Initial program 79.6%

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

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

            \[\leadsto \frac{\color{blue}{x.re \cdot y.re} + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
          3. lower-fma.f6479.6

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

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

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

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

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

        if -2.35e-66 < y.re < 9.40000000000000007e-94

        1. Initial program 69.1%

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

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

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

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

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

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

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

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

        if 5.9000000000000001e119 < y.re

        1. Initial program 33.0%

          \[\frac{x.re \cdot y.re + x.im \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.re + \frac{x.im \cdot y.im}{y.re}}{y.re}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -8 \cdot 10^{+150}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\ \mathbf{elif}\;y.re \leq -2.35 \cdot 10^{-66}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{elif}\;y.re \leq 9.4 \cdot 10^{-94}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\ \mathbf{elif}\;y.re \leq 5.9 \cdot 10^{+119}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 4: 65.1% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \frac{x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{if}\;y.re \leq -3.5 \cdot 10^{+91}:\\ \;\;\;\;\frac{x.re}{y.re}\\ \mathbf{elif}\;y.re \leq -1.55 \cdot 10^{-64}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 1.4 \cdot 10^{-109}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+112}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.re}{y.re}\\ \end{array} \end{array} \]
      (FPCore (x.re x.im y.re y.im)
       :precision binary64
       (let* ((t_0 (* y.re (/ x.re (fma y.re y.re (* y.im y.im))))))
         (if (<= y.re -3.5e+91)
           (/ x.re y.re)
           (if (<= y.re -1.55e-64)
             t_0
             (if (<= y.re 1.4e-109)
               (/ x.im y.im)
               (if (<= y.re 1.6e+112) t_0 (/ x.re y.re)))))))
      double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
      	double t_0 = y_46_re * (x_46_re / fma(y_46_re, y_46_re, (y_46_im * y_46_im)));
      	double tmp;
      	if (y_46_re <= -3.5e+91) {
      		tmp = x_46_re / y_46_re;
      	} else if (y_46_re <= -1.55e-64) {
      		tmp = t_0;
      	} else if (y_46_re <= 1.4e-109) {
      		tmp = x_46_im / y_46_im;
      	} else if (y_46_re <= 1.6e+112) {
      		tmp = t_0;
      	} else {
      		tmp = x_46_re / y_46_re;
      	}
      	return tmp;
      }
      
      function code(x_46_re, x_46_im, y_46_re, y_46_im)
      	t_0 = Float64(y_46_re * Float64(x_46_re / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))))
      	tmp = 0.0
      	if (y_46_re <= -3.5e+91)
      		tmp = Float64(x_46_re / y_46_re);
      	elseif (y_46_re <= -1.55e-64)
      		tmp = t_0;
      	elseif (y_46_re <= 1.4e-109)
      		tmp = Float64(x_46_im / y_46_im);
      	elseif (y_46_re <= 1.6e+112)
      		tmp = t_0;
      	else
      		tmp = Float64(x_46_re / 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 * N[(x$46$re / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -3.5e+91], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.55e-64], t$95$0, If[LessEqual[y$46$re, 1.4e-109], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.6e+112], t$95$0, N[(x$46$re / y$46$re), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := y.re \cdot \frac{x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
      \mathbf{if}\;y.re \leq -3.5 \cdot 10^{+91}:\\
      \;\;\;\;\frac{x.re}{y.re}\\
      
      \mathbf{elif}\;y.re \leq -1.55 \cdot 10^{-64}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y.re \leq 1.4 \cdot 10^{-109}:\\
      \;\;\;\;\frac{x.im}{y.im}\\
      
      \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+112}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{x.re}{y.re}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y.re < -3.50000000000000001e91 or 1.59999999999999993e112 < y.re

        1. Initial program 40.1%

          \[\frac{x.re \cdot y.re + x.im \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.re}{y.re}} \]
        4. Step-by-step derivation
          1. lower-/.f6480.3

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

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

        if -3.50000000000000001e91 < y.re < -1.55000000000000012e-64 or 1.39999999999999989e-109 < y.re < 1.59999999999999993e112

        1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

          if -1.55000000000000012e-64 < y.re < 1.39999999999999989e-109

          1. Initial program 68.6%

            \[\frac{x.re \cdot y.re + x.im \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}{\frac{x.im}{y.im}} \]
          4. Step-by-step derivation
            1. lower-/.f6474.0

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

            \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
        7. Recombined 3 regimes into one program.
        8. Add Preprocessing

        Alternative 5: 72.5% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.45 \cdot 10^{+105}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \mathbf{elif}\;y.im \leq 5.6 \cdot 10^{+16}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\ \mathbf{elif}\;y.im \leq 1.45 \cdot 10^{+75}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (if (<= y.im -1.45e+105)
           (/ x.im y.im)
           (if (<= y.im 5.6e+16)
             (/ (fma x.im (/ y.im y.re) x.re) y.re)
             (if (<= y.im 1.45e+75)
               (/ (fma x.re y.re (* y.im x.im)) (* y.im y.im))
               (/ x.im y.im)))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double tmp;
        	if (y_46_im <= -1.45e+105) {
        		tmp = x_46_im / y_46_im;
        	} else if (y_46_im <= 5.6e+16) {
        		tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
        	} else if (y_46_im <= 1.45e+75) {
        		tmp = fma(x_46_re, y_46_re, (y_46_im * x_46_im)) / (y_46_im * y_46_im);
        	} else {
        		tmp = x_46_im / y_46_im;
        	}
        	return tmp;
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	tmp = 0.0
        	if (y_46_im <= -1.45e+105)
        		tmp = Float64(x_46_im / y_46_im);
        	elseif (y_46_im <= 5.6e+16)
        		tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re);
        	elseif (y_46_im <= 1.45e+75)
        		tmp = Float64(fma(x_46_re, y_46_re, Float64(y_46_im * x_46_im)) / Float64(y_46_im * y_46_im));
        	else
        		tmp = Float64(x_46_im / y_46_im);
        	end
        	return tmp
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.45e+105], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 5.6e+16], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.45e+75], N[(N[(x$46$re * y$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y.im \leq -1.45 \cdot 10^{+105}:\\
        \;\;\;\;\frac{x.im}{y.im}\\
        
        \mathbf{elif}\;y.im \leq 5.6 \cdot 10^{+16}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
        
        \mathbf{elif}\;y.im \leq 1.45 \cdot 10^{+75}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(x.re, y.re, y.im \cdot x.im\right)}{y.im \cdot y.im}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x.im}{y.im}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y.im < -1.45000000000000005e105 or 1.4499999999999999e75 < y.im

          1. Initial program 44.0%

            \[\frac{x.re \cdot y.re + x.im \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}{\frac{x.im}{y.im}} \]
          4. Step-by-step derivation
            1. lower-/.f6475.0

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

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

          if -1.45000000000000005e105 < y.im < 5.6e16

          1. Initial program 70.3%

            \[\frac{x.re \cdot y.re + x.im \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.re + \frac{x.im \cdot y.im}{y.re}}{y.re}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

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

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

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

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

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

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

          if 5.6e16 < y.im < 1.4499999999999999e75

          1. Initial program 99.5%

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

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

              \[\leadsto \frac{\color{blue}{x.re \cdot y.re} + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
            3. lower-fma.f6499.5

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

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

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

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

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

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

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

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

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

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

        Alternative 6: 76.5% accurate, 0.9× speedup?

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

          1. Initial program 51.0%

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

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

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

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

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

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

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

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

          if -1.1500000000000001e99 < y.im < 2.25e15

          1. Initial program 70.1%

            \[\frac{x.re \cdot y.re + x.im \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.re + \frac{x.im \cdot y.im}{y.re}}{y.re}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

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

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

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

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

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

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

        Alternative 7: 63.5% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -5.5 \cdot 10^{+14}:\\ \;\;\;\;\frac{x.re}{y.re}\\ \mathbf{elif}\;y.re \leq 6.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.re}{y.re}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (if (<= y.re -5.5e+14)
           (/ x.re y.re)
           (if (<= y.re 6.6e-44) (/ x.im y.im) (/ x.re y.re))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double tmp;
        	if (y_46_re <= -5.5e+14) {
        		tmp = x_46_re / y_46_re;
        	} else if (y_46_re <= 6.6e-44) {
        		tmp = x_46_im / y_46_im;
        	} else {
        		tmp = x_46_re / y_46_re;
        	}
        	return tmp;
        }
        
        real(8) function code(x_46re, x_46im, y_46re, y_46im)
            real(8), intent (in) :: x_46re
            real(8), intent (in) :: x_46im
            real(8), intent (in) :: y_46re
            real(8), intent (in) :: y_46im
            real(8) :: tmp
            if (y_46re <= (-5.5d+14)) then
                tmp = x_46re / y_46re
            else if (y_46re <= 6.6d-44) then
                tmp = x_46im / y_46im
            else
                tmp = x_46re / y_46re
            end if
            code = tmp
        end function
        
        public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double tmp;
        	if (y_46_re <= -5.5e+14) {
        		tmp = x_46_re / y_46_re;
        	} else if (y_46_re <= 6.6e-44) {
        		tmp = x_46_im / y_46_im;
        	} else {
        		tmp = x_46_re / y_46_re;
        	}
        	return tmp;
        }
        
        def code(x_46_re, x_46_im, y_46_re, y_46_im):
        	tmp = 0
        	if y_46_re <= -5.5e+14:
        		tmp = x_46_re / y_46_re
        	elif y_46_re <= 6.6e-44:
        		tmp = x_46_im / y_46_im
        	else:
        		tmp = x_46_re / y_46_re
        	return tmp
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	tmp = 0.0
        	if (y_46_re <= -5.5e+14)
        		tmp = Float64(x_46_re / y_46_re);
        	elseif (y_46_re <= 6.6e-44)
        		tmp = Float64(x_46_im / y_46_im);
        	else
        		tmp = Float64(x_46_re / y_46_re);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
        	tmp = 0.0;
        	if (y_46_re <= -5.5e+14)
        		tmp = x_46_re / y_46_re;
        	elseif (y_46_re <= 6.6e-44)
        		tmp = x_46_im / y_46_im;
        	else
        		tmp = x_46_re / y_46_re;
        	end
        	tmp_2 = tmp;
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -5.5e+14], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 6.6e-44], N[(x$46$im / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y.re \leq -5.5 \cdot 10^{+14}:\\
        \;\;\;\;\frac{x.re}{y.re}\\
        
        \mathbf{elif}\;y.re \leq 6.6 \cdot 10^{-44}:\\
        \;\;\;\;\frac{x.im}{y.im}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x.re}{y.re}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y.re < -5.5e14 or 6.60000000000000011e-44 < y.re

          1. Initial program 53.4%

            \[\frac{x.re \cdot y.re + x.im \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.re}{y.re}} \]
          4. Step-by-step derivation
            1. lower-/.f6467.1

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

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

          if -5.5e14 < y.re < 6.60000000000000011e-44

          1. Initial program 73.0%

            \[\frac{x.re \cdot y.re + x.im \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}{\frac{x.im}{y.im}} \]
          4. Step-by-step derivation
            1. lower-/.f6468.2

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

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

        Alternative 8: 43.3% accurate, 3.2× speedup?

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

          \[\frac{x.re \cdot y.re + x.im \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}{\frac{x.im}{y.im}} \]
        4. Step-by-step derivation
          1. lower-/.f6440.6

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

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

        Reproduce

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