_divideComplex, real part

Percentage Accurate: 62.2% → 80.2%
Time: 8.2s
Alternatives: 7
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 7 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: 62.2% 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: 80.2% accurate, 0.7× 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 -3 \cdot 10^{-71}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{-134}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\ \mathbf{elif}\;y.im \leq 2.05 \cdot 10^{+105}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\ \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 -3e-71)
     t_0
     (if (<= y.im 9e-134)
       (/ (fma (/ y.im y.re) x.im x.re) y.re)
       (if (<= y.im 2.05e+105)
         (/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
         t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
	double tmp;
	if (y_46_im <= -3e-71) {
		tmp = t_0;
	} else if (y_46_im <= 9e-134) {
		tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
	} else if (y_46_im <= 2.05e+105) {
		tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im)
	tmp = 0.0
	if (y_46_im <= -3e-71)
		tmp = t_0;
	elseif (y_46_im <= 9e-134)
		tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re);
	elseif (y_46_im <= 2.05e+105)
		tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)));
	else
		tmp = t_0;
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3e-71], t$95$0, If[LessEqual[y$46$im, 9e-134], 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, 2.05e+105], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $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 -3 \cdot 10^{-71}:\\
\;\;\;\;t\_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -3.0000000000000001e-71 or 2.0500000000000001e105 < y.im

    1. Initial program 45.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 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-/.f6489.0

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

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

    if -3.0000000000000001e-71 < y.im < 9.000000000000001e-134

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 9.000000000000001e-134 < y.im < 2.0500000000000001e105

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 76.9% 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 -3 \cdot 10^{-71}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\ \;\;\;\;\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 -3e-71)
         t_0
         (if (<= y.im 1.75e-81) (/ (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 <= -3e-71) {
    		tmp = t_0;
    	} else if (y_46_im <= 1.75e-81) {
    		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 <= -3e-71)
    		tmp = t_0;
    	elseif (y_46_im <= 1.75e-81)
    		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, -3e-71], t$95$0, If[LessEqual[y$46$im, 1.75e-81], 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 -3 \cdot 10^{-71}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\
    \;\;\;\;\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 < -3.0000000000000001e-71 or 1.74999999999999993e-81 < y.im

      1. Initial program 52.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 + \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.1

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

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

      if -3.0000000000000001e-71 < y.im < 1.74999999999999993e-81

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 76.1% 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 -3 \cdot 10^{-71}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\ \;\;\;\;\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 -3e-71)
           t_0
           (if (<= y.im 1.75e-81) (/ (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 <= -3e-71) {
      		tmp = t_0;
      	} else if (y_46_im <= 1.75e-81) {
      		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 <= -3e-71)
      		tmp = t_0;
      	elseif (y_46_im <= 1.75e-81)
      		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, -3e-71], t$95$0, If[LessEqual[y$46$im, 1.75e-81], 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 -3 \cdot 10^{-71}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\
      \;\;\;\;\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 < -3.0000000000000001e-71 or 1.74999999999999993e-81 < y.im

        1. Initial program 52.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 + \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.1

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

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

        if -3.0000000000000001e-71 < y.im < 1.74999999999999993e-81

        1. Initial program 71.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-/.f6487.0

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

          \[\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 4: 71.0% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -3 \cdot 10^{-71}:\\ \;\;\;\;\frac{1}{\frac{y.im}{x.im}}\\ \mathbf{elif}\;y.im \leq 8.5 \cdot 10^{+69}:\\ \;\;\;\;\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 -3e-71)
         (/ 1.0 (/ y.im x.im))
         (if (<= y.im 8.5e+69)
           (/ (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 <= -3e-71) {
      		tmp = 1.0 / (y_46_im / x_46_im);
      	} else if (y_46_im <= 8.5e+69) {
      		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 <= -3e-71)
      		tmp = Float64(1.0 / Float64(y_46_im / x_46_im));
      	elseif (y_46_im <= 8.5e+69)
      		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, -3e-71], N[(1.0 / N[(y$46$im / x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 8.5e+69], 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 -3 \cdot 10^{-71}:\\
      \;\;\;\;\frac{1}{\frac{y.im}{x.im}}\\
      
      \mathbf{elif}\;y.im \leq 8.5 \cdot 10^{+69}:\\
      \;\;\;\;\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 3 regimes
      2. if y.im < -3.0000000000000001e-71

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

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

          \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
        6. Step-by-step derivation
          1. Applied rewrites73.1%

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

          if -3.0000000000000001e-71 < y.im < 8.5000000000000002e69

          1. Initial program 70.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. *-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-/.f6479.1

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

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

          if 8.5000000000000002e69 < y.im

          1. Initial program 45.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-/.f6468.6

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

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

        Alternative 5: 63.0% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -3 \cdot 10^{-71}:\\ \;\;\;\;\frac{1}{\frac{y.im}{x.im}}\\ \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\ \;\;\;\;\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 -3e-71)
           (/ 1.0 (/ y.im x.im))
           (if (<= y.im 1.75e-81) (/ 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 <= -3e-71) {
        		tmp = 1.0 / (y_46_im / x_46_im);
        	} else if (y_46_im <= 1.75e-81) {
        		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 <= (-3d-71)) then
                tmp = 1.0d0 / (y_46im / x_46im)
            else if (y_46im <= 1.75d-81) 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 <= -3e-71) {
        		tmp = 1.0 / (y_46_im / x_46_im);
        	} else if (y_46_im <= 1.75e-81) {
        		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 <= -3e-71:
        		tmp = 1.0 / (y_46_im / x_46_im)
        	elif y_46_im <= 1.75e-81:
        		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 <= -3e-71)
        		tmp = Float64(1.0 / Float64(y_46_im / x_46_im));
        	elseif (y_46_im <= 1.75e-81)
        		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 <= -3e-71)
        		tmp = 1.0 / (y_46_im / x_46_im);
        	elseif (y_46_im <= 1.75e-81)
        		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, -3e-71], N[(1.0 / N[(y$46$im / x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.75e-81], 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 -3 \cdot 10^{-71}:\\
        \;\;\;\;\frac{1}{\frac{y.im}{x.im}}\\
        
        \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\
        \;\;\;\;\frac{x.re}{y.re}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x.im}{y.im}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y.im < -3.0000000000000001e-71

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

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

            \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
          6. Step-by-step derivation
            1. Applied rewrites73.1%

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

            if -3.0000000000000001e-71 < y.im < 1.74999999999999993e-81

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

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

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

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

            if 1.74999999999999993e-81 < y.im

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

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

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

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

          Alternative 6: 63.1% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -3 \cdot 10^{-71}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\ \;\;\;\;\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 -3e-71)
             (/ x.im y.im)
             (if (<= y.im 1.75e-81) (/ 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 <= -3e-71) {
          		tmp = x_46_im / y_46_im;
          	} else if (y_46_im <= 1.75e-81) {
          		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 <= (-3d-71)) then
                  tmp = x_46im / y_46im
              else if (y_46im <= 1.75d-81) 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 <= -3e-71) {
          		tmp = x_46_im / y_46_im;
          	} else if (y_46_im <= 1.75e-81) {
          		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 <= -3e-71:
          		tmp = x_46_im / y_46_im
          	elif y_46_im <= 1.75e-81:
          		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 <= -3e-71)
          		tmp = Float64(x_46_im / y_46_im);
          	elseif (y_46_im <= 1.75e-81)
          		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 <= -3e-71)
          		tmp = x_46_im / y_46_im;
          	elseif (y_46_im <= 1.75e-81)
          		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, -3e-71], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.75e-81], 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 -3 \cdot 10^{-71}:\\
          \;\;\;\;\frac{x.im}{y.im}\\
          
          \mathbf{elif}\;y.im \leq 1.75 \cdot 10^{-81}:\\
          \;\;\;\;\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 < -3.0000000000000001e-71 or 1.74999999999999993e-81 < y.im

            1. Initial program 52.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-/.f6465.9

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

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

            if -3.0000000000000001e-71 < y.im < 1.74999999999999993e-81

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

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

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

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

          Alternative 7: 41.8% 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 59.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}{y.im}} \]
          4. Step-by-step derivation
            1. lower-/.f6446.0

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

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

          Reproduce

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