_divideComplex, real part

Percentage Accurate: 61.6% → 83.0%
Time: 8.0s
Alternatives: 9
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 9 alternatives:

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

Initial Program: 61.6% 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: 83.0% accurate, 0.6× speedup?

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

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

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

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

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

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


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

    1. Initial program 45.2%

      \[\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. *-commutativeN/A

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

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

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

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

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

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

    if -7.49999999999999946e92 < y.im < -1.75e-106 or 2.10000000000000002e-110 < y.im < 7.5000000000000005e67

    1. Initial program 84.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

    if -1.75e-106 < y.im < 2.10000000000000002e-110

    1. Initial program 70.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}{y.im}} \]
    4. Step-by-step derivation
      1. lower-/.f6415.3

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

      \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
    6. Taylor expanded in y.re around inf

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

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

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

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

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

    if 7.5000000000000005e67 < y.im

    1. Initial program 23.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.im around inf

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

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

      \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
    6. Taylor expanded in y.im around inf

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\left(-y.re\right) \cdot \frac{-1}{y.im}, x.re, x.im\right)}{y.im} \]
    10. Recombined 4 regimes into one program.
    11. Final simplification86.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -7.5 \cdot 10^{+92}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\ \mathbf{elif}\;y.im \leq -1.75 \cdot 10^{-106}:\\ \;\;\;\;\frac{x.im \cdot y.im + y.re \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{elif}\;y.im \leq 2.1 \cdot 10^{-110}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\ \mathbf{elif}\;y.im \leq 7.5 \cdot 10^{+67}:\\ \;\;\;\;\frac{x.im \cdot y.im + y.re \cdot x.re}{y.im \cdot y.im + y.re \cdot y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-1}{y.im} \cdot \left(-y.re\right), x.re, x.im\right)}{y.im}\\ \end{array} \]
    12. Add Preprocessing

    Alternative 2: 64.7% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\ \mathbf{if}\;y.im \leq -2.8 \cdot 10^{+90}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \mathbf{elif}\;y.im \leq -3.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{y.im}{t\_0} \cdot x.im\\ \mathbf{elif}\;y.im \leq 1.05 \cdot 10^{-158}:\\ \;\;\;\;\frac{x.re}{y.re}\\ \mathbf{elif}\;y.im \leq 2.8 \cdot 10^{+155}:\\ \;\;\;\;\frac{x.im}{t\_0} \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
     (let* ((t_0 (fma y.im y.im (* y.re y.re))))
       (if (<= y.im -2.8e+90)
         (/ x.im y.im)
         (if (<= y.im -3.6e-114)
           (* (/ y.im t_0) x.im)
           (if (<= y.im 1.05e-158)
             (/ x.re y.re)
             (if (<= y.im 2.8e+155) (* (/ x.im t_0) 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 t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
    	double tmp;
    	if (y_46_im <= -2.8e+90) {
    		tmp = x_46_im / y_46_im;
    	} else if (y_46_im <= -3.6e-114) {
    		tmp = (y_46_im / t_0) * x_46_im;
    	} else if (y_46_im <= 1.05e-158) {
    		tmp = x_46_re / y_46_re;
    	} else if (y_46_im <= 2.8e+155) {
    		tmp = (x_46_im / t_0) * 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)
    	t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))
    	tmp = 0.0
    	if (y_46_im <= -2.8e+90)
    		tmp = Float64(x_46_im / y_46_im);
    	elseif (y_46_im <= -3.6e-114)
    		tmp = Float64(Float64(y_46_im / t_0) * x_46_im);
    	elseif (y_46_im <= 1.05e-158)
    		tmp = Float64(x_46_re / y_46_re);
    	elseif (y_46_im <= 2.8e+155)
    		tmp = Float64(Float64(x_46_im / t_0) * 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_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -2.8e+90], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -3.6e-114], N[(N[(y$46$im / t$95$0), $MachinePrecision] * x$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.05e-158], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.8e+155], N[(N[(x$46$im / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
    \mathbf{if}\;y.im \leq -2.8 \cdot 10^{+90}:\\
    \;\;\;\;\frac{x.im}{y.im}\\
    
    \mathbf{elif}\;y.im \leq -3.6 \cdot 10^{-114}:\\
    \;\;\;\;\frac{y.im}{t\_0} \cdot x.im\\
    
    \mathbf{elif}\;y.im \leq 1.05 \cdot 10^{-158}:\\
    \;\;\;\;\frac{x.re}{y.re}\\
    
    \mathbf{elif}\;y.im \leq 2.8 \cdot 10^{+155}:\\
    \;\;\;\;\frac{x.im}{t\_0} \cdot y.im\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x.im}{y.im}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if y.im < -2.8e90 or 2.80000000000000016e155 < y.im

      1. Initial program 32.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.im around inf

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

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

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

      if -2.8e90 < y.im < -3.60000000000000018e-114

      1. Initial program 84.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}{y.im}} \]
      4. Step-by-step derivation
        1. lower-/.f6439.3

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

        \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
      6. Taylor expanded in x.im around inf

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

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

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

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

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

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

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

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

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

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

      if -3.60000000000000018e-114 < y.im < 1.04999999999999996e-158

      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.im around 0

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

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

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

      if 1.04999999999999996e-158 < y.im < 2.80000000000000016e155

      1. Initial program 68.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 x.im around inf

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 64.3% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.im\\ \mathbf{if}\;y.im \leq -1.6 \cdot 10^{+100}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \mathbf{elif}\;y.im \leq -3.6 \cdot 10^{-114}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.05 \cdot 10^{-158}:\\ \;\;\;\;\frac{x.re}{y.re}\\ \mathbf{elif}\;y.im \leq 2.8 \cdot 10^{+155}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (let* ((t_0 (* (/ x.im (fma y.im y.im (* y.re y.re))) y.im)))
       (if (<= y.im -1.6e+100)
         (/ x.im y.im)
         (if (<= y.im -3.6e-114)
           t_0
           (if (<= y.im 1.05e-158)
             (/ x.re y.re)
             (if (<= y.im 2.8e+155) t_0 (/ x.im y.im)))))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double t_0 = (x_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * y_46_im;
    	double tmp;
    	if (y_46_im <= -1.6e+100) {
    		tmp = x_46_im / y_46_im;
    	} else if (y_46_im <= -3.6e-114) {
    		tmp = t_0;
    	} else if (y_46_im <= 1.05e-158) {
    		tmp = x_46_re / y_46_re;
    	} else if (y_46_im <= 2.8e+155) {
    		tmp = t_0;
    	} else {
    		tmp = x_46_im / y_46_im;
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	t_0 = Float64(Float64(x_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -1.6e+100)
    		tmp = Float64(x_46_im / y_46_im);
    	elseif (y_46_im <= -3.6e-114)
    		tmp = t_0;
    	elseif (y_46_im <= 1.05e-158)
    		tmp = Float64(x_46_re / y_46_re);
    	elseif (y_46_im <= 2.8e+155)
    		tmp = t_0;
    	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_] := Block[{t$95$0 = N[(N[(x$46$im / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.6e+100], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -3.6e-114], t$95$0, If[LessEqual[y$46$im, 1.05e-158], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.8e+155], t$95$0, N[(x$46$im / y$46$im), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.im\\
    \mathbf{if}\;y.im \leq -1.6 \cdot 10^{+100}:\\
    \;\;\;\;\frac{x.im}{y.im}\\
    
    \mathbf{elif}\;y.im \leq -3.6 \cdot 10^{-114}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 1.05 \cdot 10^{-158}:\\
    \;\;\;\;\frac{x.re}{y.re}\\
    
    \mathbf{elif}\;y.im \leq 2.8 \cdot 10^{+155}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x.im}{y.im}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.im < -1.5999999999999999e100 or 2.80000000000000016e155 < y.im

      1. Initial program 30.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. Taylor expanded in y.im around inf

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

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

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

      if -1.5999999999999999e100 < y.im < -3.60000000000000018e-114 or 1.04999999999999996e-158 < y.im < 2.80000000000000016e155

      1. Initial program 75.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. Taylor expanded in x.im around inf

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

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

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

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

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

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

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

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

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

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

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

      if -3.60000000000000018e-114 < y.im < 1.04999999999999996e-158

      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.im around 0

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

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

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

    Alternative 4: 77.1% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -9 \cdot 10^{-102}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.re, x.im\right)}{y.im}\\ \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-12}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (<= y.im -9e-102)
       (/ (fma (/ y.re y.im) x.re x.im) y.im)
       (if (<= y.im 3.4e-12)
         (/ (fma (/ y.im y.re) x.im x.re) y.re)
         (/ (fma (/ x.re y.im) y.re x.im) y.im))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double tmp;
    	if (y_46_im <= -9e-102) {
    		tmp = fma((y_46_re / y_46_im), x_46_re, x_46_im) / y_46_im;
    	} else if (y_46_im <= 3.4e-12) {
    		tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
    	} else {
    		tmp = fma((x_46_re / y_46_im), y_46_re, 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 <= -9e-102)
    		tmp = Float64(fma(Float64(y_46_re / y_46_im), x_46_re, x_46_im) / y_46_im);
    	elseif (y_46_im <= 3.4e-12)
    		tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re);
    	else
    		tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, 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, -9e-102], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * x$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 3.4e-12], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.im \leq -9 \cdot 10^{-102}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.re, x.im\right)}{y.im}\\
    
    \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-12}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.im < -8.99999999999999999e-102

      1. Initial program 66.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}{y.im}} \]
      4. Step-by-step derivation
        1. lower-/.f6455.1

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

        \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
      6. Taylor expanded in y.im around inf

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

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

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

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

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

      if -8.99999999999999999e-102 < y.im < 3.4000000000000001e-12

      1. Initial program 72.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. Taylor expanded in y.im around inf

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

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

        \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
      6. Taylor expanded in y.re around inf

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

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

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

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

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

      if 3.4000000000000001e-12 < y.im

      1. Initial program 36.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. *-commutativeN/A

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

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

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

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

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

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

    Alternative 5: 78.3% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\ \mathbf{if}\;y.im \leq -1.8 \cdot 10^{-34}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-12}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, 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.im) y.re x.im) y.im)))
       (if (<= y.im -1.8e-34)
         t_0
         (if (<= y.im 3.4e-12) (/ (fma (/ y.im y.re) x.im 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_im), y_46_re, x_46_im) / y_46_im;
    	double tmp;
    	if (y_46_im <= -1.8e-34) {
    		tmp = t_0;
    	} else if (y_46_im <= 3.4e-12) {
    		tmp = fma((y_46_im / y_46_re), x_46_im, 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(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -1.8e-34)
    		tmp = t_0;
    	elseif (y_46_im <= 3.4e-12)
    		tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, 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[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.8e-34], t$95$0, If[LessEqual[y$46$im, 3.4e-12], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
    \mathbf{if}\;y.im \leq -1.8 \cdot 10^{-34}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-12}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, 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.80000000000000004e-34 or 3.4000000000000001e-12 < y.im

      1. Initial program 48.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.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. *-commutativeN/A

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

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

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

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

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

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

      if -1.80000000000000004e-34 < y.im < 3.4000000000000001e-12

      1. Initial program 74.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.im around inf

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

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

        \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
      6. Taylor expanded in y.re around inf

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

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

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

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

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

    Alternative 6: 77.4% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\ \mathbf{if}\;y.im \leq -1.75 \cdot 10^{-34}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-12}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, 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.im) y.re x.im) y.im)))
       (if (<= y.im -1.75e-34)
         t_0
         (if (<= y.im 3.4e-12) (/ (fma (/ x.im y.re) y.im 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_im), y_46_re, x_46_im) / y_46_im;
    	double tmp;
    	if (y_46_im <= -1.75e-34) {
    		tmp = t_0;
    	} else if (y_46_im <= 3.4e-12) {
    		tmp = fma((x_46_im / y_46_re), y_46_im, 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(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -1.75e-34)
    		tmp = t_0;
    	elseif (y_46_im <= 3.4e-12)
    		tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, 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[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.75e-34], t$95$0, If[LessEqual[y$46$im, 3.4e-12], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
    \mathbf{if}\;y.im \leq -1.75 \cdot 10^{-34}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 3.4 \cdot 10^{-12}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, 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.75e-34 or 3.4000000000000001e-12 < y.im

      1. Initial program 48.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.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. *-commutativeN/A

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

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

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

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

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

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

      if -1.75e-34 < y.im < 3.4000000000000001e-12

      1. Initial program 74.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 + \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. *-commutativeN/A

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

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

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

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

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

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

    Alternative 7: 72.2% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.55 \cdot 10^{+40}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \mathbf{elif}\;y.im \leq 1.15 \cdot 10^{+76}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \end{array} \end{array} \]
    (FPCore (x.re x.im y.re y.im)
     :precision binary64
     (if (<= y.im -1.55e+40)
       (/ x.im y.im)
       (if (<= y.im 1.15e+76)
         (/ (fma (/ x.im y.re) y.im x.re) y.re)
         (/ x.im y.im))))
    double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
    	double tmp;
    	if (y_46_im <= -1.55e+40) {
    		tmp = x_46_im / y_46_im;
    	} else if (y_46_im <= 1.15e+76) {
    		tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
    	} else {
    		tmp = x_46_im / y_46_im;
    	}
    	return tmp;
    }
    
    function code(x_46_re, x_46_im, y_46_re, y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -1.55e+40)
    		tmp = Float64(x_46_im / y_46_im);
    	elseif (y_46_im <= 1.15e+76)
    		tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re);
    	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.55e+40], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.15e+76], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y.im \leq -1.55 \cdot 10^{+40}:\\
    \;\;\;\;\frac{x.im}{y.im}\\
    
    \mathbf{elif}\;y.im \leq 1.15 \cdot 10^{+76}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x.im}{y.im}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y.im < -1.5499999999999999e40 or 1.15000000000000001e76 < y.im

      1. Initial program 40.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}{y.im}} \]
      4. Step-by-step derivation
        1. lower-/.f6473.8

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

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

      if -1.5499999999999999e40 < y.im < 1.15000000000000001e76

      1. Initial program 74.8%

        \[\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. *-commutativeN/A

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

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

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

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

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

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

    Alternative 8: 64.4% accurate, 1.6× speedup?

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

      1. Initial program 44.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.im around inf

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

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

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

      if -1.5499999999999999e40 < y.im < 9.99999999999999999e-15

      1. Initial program 75.8%

        \[\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 0

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

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

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

    Alternative 9: 42.9% 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 60.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.im around inf

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

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

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

    Reproduce

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