_divideComplex, imaginary part

Percentage Accurate: 61.3% → 90.9%
Time: 11.3s
Alternatives: 8
Speedup: 1.0×

Specification

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

\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 61.3% accurate, 1.0× speedup?

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

\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}

Alternative 1: 90.9% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x.im}{y.re + y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}\\
t_1 := \frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.4 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -2.39999999999999985e187 or 1.35000000000000003e154 < y.im

    1. Initial program 34.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{x.im \cdot y.re}{y.im}\right), x.re\right), y.im\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(x.im \cdot y.re\right), y.im\right), x.re\right), y.im\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(y.re \cdot x.im\right), y.im\right), x.re\right), y.im\right) \]
      11. *-lowering-*.f6487.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(y.re, x.im\right), y.im\right), x.re\right), y.im\right) \]
    5. Simplified87.0%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(y.re \cdot \frac{x.im}{y.im}\right), x.re\right), y.im\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{x.im}{y.im} \cdot y.re\right), x.re\right), y.im\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(\frac{x.im}{y.im}\right), y.re\right), x.re\right), y.im\right) \]
      4. /-lowering-/.f6497.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x.im, y.im\right), y.re\right), x.re\right), y.im\right) \]
    7. Applied egg-rr97.3%

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

    if -2.39999999999999985e187 < y.im < -1.49999999999999998e-160 or 2.00000000000000004e-194 < y.im < 1.35000000000000003e154

    1. Initial program 69.7%

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

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

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

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

        \[\leadsto \mathsf{\_.f64}\left(\left(x.im \cdot \frac{1}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.re}}\right), \left(\frac{x.re \cdot \color{blue}{y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      5. un-div-invN/A

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

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

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

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(y.re \cdot y.re\right), \left(y.im \cdot y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \left(y.im \cdot y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      11. associate-/l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(x.re \cdot \color{blue}{\frac{y.im}{y.re \cdot y.re + y.im \cdot y.im}}\right)\right) \]
      12. clear-numN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(x.re \cdot \frac{1}{\color{blue}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right)\right) \]
      13. un-div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right), \color{blue}{y.im}\right)\right)\right) \]
      16. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(y.re \cdot y.re\right), \left(y.im \cdot y.im\right)\right), y.im\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \left(y.im \cdot y.im\right)\right), y.im\right)\right)\right) \]
      18. *-lowering-*.f6473.3%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
    4. Applied egg-rr73.3%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.re}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}} \]
    5. Taylor expanded in y.im around 0

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \color{blue}{\left(y.re + \frac{{y.im}^{2}}{y.re}\right)}\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(\frac{{y.im}^{2}}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(\frac{y.im \cdot y.im}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      3. associate-/l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(y.im \cdot \frac{y.im}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{*.f64}\left(y.im, \left(\frac{y.im}{y.re}\right)\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      5. /-lowering-/.f6491.4%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{*.f64}\left(y.im, \mathsf{/.f64}\left(y.im, y.re\right)\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
    7. Simplified91.4%

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

    if -1.49999999999999998e-160 < y.im < 2.00000000000000004e-194

    1. Initial program 68.9%

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x.im - \frac{x.re \cdot y.im}{y.re}\right), y.re\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(\frac{x.re \cdot y.im}{y.re}\right)\right), y.re\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\left(x.re \cdot y.im\right), y.re\right)\right), y.re\right) \]
      6. *-lowering-*.f6491.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x.re, y.im\right), y.re\right)\right), y.re\right) \]
    5. Simplified91.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.4 \cdot 10^{+187}:\\ \;\;\;\;\frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.5 \cdot 10^{-160}:\\ \;\;\;\;\frac{x.im}{y.re + y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}\\ \mathbf{elif}\;y.im \leq 2 \cdot 10^{-194}:\\ \;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{x.im}{y.re + y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x.im}{y.re + y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -7 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -6.9999999999999997e-26 or 1.5500000000000001e-12 < y.im

    1. Initial program 50.2%

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

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

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

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

        \[\leadsto \mathsf{\_.f64}\left(\left(x.im \cdot \frac{1}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.re}}\right), \left(\frac{x.re \cdot \color{blue}{y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      5. un-div-invN/A

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

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

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

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(y.re \cdot y.re\right), \left(y.im \cdot y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \left(y.im \cdot y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
      11. associate-/l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(x.re \cdot \color{blue}{\frac{y.im}{y.re \cdot y.re + y.im \cdot y.im}}\right)\right) \]
      12. clear-numN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(x.re \cdot \frac{1}{\color{blue}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right)\right) \]
      13. un-div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right), \color{blue}{y.im}\right)\right)\right) \]
      16. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(y.re \cdot y.re\right), \left(y.im \cdot y.im\right)\right), y.im\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \left(y.im \cdot y.im\right)\right), y.im\right)\right)\right) \]
      18. *-lowering-*.f6454.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
    4. Applied egg-rr54.2%

      \[\leadsto \color{blue}{\frac{x.im}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.re}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}} \]
    5. Taylor expanded in y.im around 0

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \color{blue}{\left(y.re + \frac{{y.im}^{2}}{y.re}\right)}\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(\frac{{y.im}^{2}}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(\frac{y.im \cdot y.im}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      3. associate-/l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(y.im \cdot \frac{y.im}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{*.f64}\left(y.im, \left(\frac{y.im}{y.re}\right)\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      5. /-lowering-/.f6464.5%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{*.f64}\left(y.im, \mathsf{/.f64}\left(y.im, y.re\right)\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
    7. Simplified64.5%

      \[\leadsto \frac{x.im}{\color{blue}{y.re + y.im \cdot \frac{y.im}{y.re}}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}} \]
    8. Taylor expanded in y.re around 0

      \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{*.f64}\left(y.im, \mathsf{/.f64}\left(y.im, y.re\right)\right)\right)\right), \mathsf{/.f64}\left(x.re, \color{blue}{y.im}\right)\right) \]
    9. Step-by-step derivation
      1. Simplified81.7%

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

      if -6.9999999999999997e-26 < y.im < 1.5500000000000001e-12

      1. Initial program 72.8%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(x.im - \frac{x.re \cdot y.im}{y.re}\right), y.re\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(\frac{x.re \cdot y.im}{y.re}\right)\right), y.re\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\left(x.re \cdot y.im\right), y.re\right)\right), y.re\right) \]
        6. *-lowering-*.f6485.6%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x.re, y.im\right), y.re\right)\right), y.re\right) \]
      5. Simplified85.6%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -7 \cdot 10^{-26}:\\ \;\;\;\;\frac{x.im}{y.re + y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 1.55 \cdot 10^{-12}:\\ \;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re + y.im \cdot \frac{y.im}{y.re}} - \frac{x.re}{y.im}\\ \end{array} \]
    12. Add Preprocessing

    Alternative 3: 77.9% accurate, 0.8× speedup?

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

      1. Initial program 47.7%

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{x.im \cdot y.re}{y.im}\right), x.re\right), y.im\right) \]
        9. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(x.im \cdot y.re\right), y.im\right), x.re\right), y.im\right) \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(y.re \cdot x.im\right), y.im\right), x.re\right), y.im\right) \]
        11. *-lowering-*.f6475.7%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(y.re, x.im\right), y.im\right), x.re\right), y.im\right) \]
      5. Simplified75.7%

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(y.re \cdot \frac{x.im}{y.im}\right), x.re\right), y.im\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\frac{x.im}{y.im} \cdot y.re\right), x.re\right), y.im\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(\frac{x.im}{y.im}\right), y.re\right), x.re\right), y.im\right) \]
        4. /-lowering-/.f6482.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(x.im, y.im\right), y.re\right), x.re\right), y.im\right) \]
      7. Applied egg-rr82.1%

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

      if -6.29999999999999961e-25 < y.im < 1.80000000000000013e41

      1. Initial program 72.1%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(x.im - \frac{x.re \cdot y.im}{y.re}\right), y.re\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(\frac{x.re \cdot y.im}{y.re}\right)\right), y.re\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\left(x.re \cdot y.im\right), y.re\right)\right), y.re\right) \]
        6. *-lowering-*.f6481.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x.re, y.im\right), y.re\right)\right), y.re\right) \]
      5. Simplified81.1%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -6.3 \cdot 10^{-25}:\\ \;\;\;\;\frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+41}:\\ \;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 4: 72.0% accurate, 0.8× speedup?

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

      1. Initial program 47.7%

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

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

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

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

          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{x.re}{y.im}\right)}\right) \]
        4. /-lowering-/.f6469.0%

          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(x.re, \color{blue}{y.im}\right)\right) \]
      5. Simplified69.0%

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

      if -8.5000000000000007e-31 < y.im < 1.26e42

      1. Initial program 72.1%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\left(x.im - \frac{x.re \cdot y.im}{y.re}\right), y.re\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(\frac{x.re \cdot y.im}{y.re}\right)\right), y.re\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\left(x.re \cdot y.im\right), y.re\right)\right), y.re\right) \]
        6. *-lowering-*.f6481.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x.re, y.im\right), y.re\right)\right), y.re\right) \]
      5. Simplified81.1%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -8.5 \cdot 10^{-31}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 1.26 \cdot 10^{+42}:\\ \;\;\;\;\frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 72.0% accurate, 0.8× speedup?

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

      1. Initial program 47.7%

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

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

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

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

          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{x.re}{y.im}\right)}\right) \]
        4. /-lowering-/.f6469.0%

          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(x.re, \color{blue}{y.im}\right)\right) \]
      5. Simplified69.0%

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

      if -1.5499999999999999e-23 < y.im < 1.4e42

      1. Initial program 72.1%

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

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

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

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

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

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

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \left(\frac{-1 \cdot x.re}{y.re \cdot y.re} + -1 \cdot \frac{x.im \cdot y.im}{{y.re}^{3}}\right)\right)\right) \]
        7. times-fracN/A

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \left(\frac{-1}{y.re} \cdot \frac{x.re}{y.re} + \frac{-1 \cdot \left(x.im \cdot y.im\right)}{\color{blue}{{y.re}^{3}}}\right)\right)\right) \]
        9. cube-multN/A

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \left(\frac{-1}{y.re} \cdot \frac{x.re}{y.re} + \frac{-1 \cdot \left(x.im \cdot y.im\right)}{y.re \cdot {y.re}^{\color{blue}{2}}}\right)\right)\right) \]
        11. times-fracN/A

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \left(\frac{-1}{y.re} \cdot \frac{x.re}{y.re} + \frac{-1}{y.re} \cdot \color{blue}{\frac{x.im \cdot y.im}{{y.re}^{2}}}\right)\right)\right) \]
        12. distribute-lft-outN/A

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

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

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

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, y.re\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.re, y.re\right), \left(\frac{\color{blue}{x.im \cdot y.im}}{{y.re}^{2}}\right)\right)\right)\right)\right) \]
        17. unpow2N/A

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

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

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, y.re\right), \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.re, y.re\right), \mathsf{/.f64}\left(\left(\frac{x.im \cdot y.im}{y.re}\right), \color{blue}{y.re}\right)\right)\right)\right)\right) \]
      5. Simplified68.0%

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, y.re\right), \color{blue}{\left(\frac{x.re}{y.re}\right)}\right)\right)\right) \]
      7. Step-by-step derivation
        1. /-lowering-/.f6473.8%

          \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(y.im, \mathsf{*.f64}\left(\mathsf{/.f64}\left(-1, y.re\right), \mathsf{/.f64}\left(x.re, \color{blue}{y.re}\right)\right)\right)\right) \]
      8. Simplified73.8%

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x.im, \frac{1}{y.re}, \mathsf{neg}\left(\frac{y.im}{y.re} \cdot \frac{x.re}{y.re}\right)\right) \]
        10. fmm-undefN/A

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

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

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

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

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(\left(\frac{y.im}{y.re}\right), \color{blue}{\left(\frac{x.re}{y.re}\right)}\right)\right) \]
        15. /-lowering-/.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(y.im, y.re\right), \left(\frac{\color{blue}{x.re}}{y.re}\right)\right)\right) \]
        16. /-lowering-/.f6476.6%

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, y.re\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(y.im, y.re\right), \mathsf{/.f64}\left(x.re, \color{blue}{y.re}\right)\right)\right) \]
      10. Applied egg-rr76.6%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(\frac{y.im}{y.re} \cdot x.re\right)\right), y.re\right) \]
        5. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(x.re \cdot \frac{y.im}{y.re}\right)\right), y.re\right) \]
        6. clear-numN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(x.re \cdot \frac{1}{\frac{y.re}{y.im}}\right)\right), y.re\right) \]
        7. un-div-invN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \left(\frac{x.re}{\frac{y.re}{y.im}}\right)\right), y.re\right) \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(x.re, \left(\frac{y.re}{y.im}\right)\right)\right), y.re\right) \]
        9. /-lowering-/.f6480.4%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(x.im, \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(y.re, y.im\right)\right)\right), y.re\right) \]
      12. Applied egg-rr80.4%

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

    Alternative 6: 65.7% accurate, 0.8× speedup?

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

      1. Initial program 45.8%

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

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

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

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

          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{x.re}{y.im}\right)}\right) \]
        4. /-lowering-/.f6474.0%

          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(x.re, \color{blue}{y.im}\right)\right) \]
      5. Simplified74.0%

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

      if -1.9000000000000001e-34 < y.im < 1.54999999999999993e149

      1. Initial program 70.0%

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

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

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

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

          \[\leadsto \mathsf{\_.f64}\left(\left(x.im \cdot \frac{1}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.re}}\right), \left(\frac{x.re \cdot \color{blue}{y.im}}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        5. un-div-invN/A

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

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

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

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(y.re \cdot y.re\right), \left(y.im \cdot y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \left(y.im \cdot y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)\right) \]
        11. associate-/l*N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(x.re \cdot \color{blue}{\frac{y.im}{y.re \cdot y.re + y.im \cdot y.im}}\right)\right) \]
        12. clear-numN/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \left(x.re \cdot \frac{1}{\color{blue}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}}\right)\right) \]
        13. un-div-invN/A

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

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

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\left(y.re \cdot y.re + y.im \cdot y.im\right), \color{blue}{y.im}\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(y.re \cdot y.re\right), \left(y.im \cdot y.im\right)\right), y.im\right)\right)\right) \]
        17. *-lowering-*.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \left(y.im \cdot y.im\right)\right), y.im\right)\right)\right) \]
        18. *-lowering-*.f6469.3%

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.re\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      4. Applied egg-rr69.3%

        \[\leadsto \color{blue}{\frac{x.im}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.re}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}}} \]
      5. Taylor expanded in y.im around 0

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \color{blue}{\left(y.re + \frac{{y.im}^{2}}{y.re}\right)}\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      6. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(\frac{{y.im}^{2}}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(\frac{y.im \cdot y.im}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
        3. associate-/l*N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \left(y.im \cdot \frac{y.im}{y.re}\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{*.f64}\left(y.im, \left(\frac{y.im}{y.re}\right)\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
        5. /-lowering-/.f6487.9%

          \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{*.f64}\left(y.im, \mathsf{/.f64}\left(y.im, y.re\right)\right)\right)\right), \mathsf{/.f64}\left(x.re, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(y.re, y.re\right), \mathsf{*.f64}\left(y.im, y.im\right)\right), y.im\right)\right)\right) \]
      7. Simplified87.9%

        \[\leadsto \frac{x.im}{\color{blue}{y.re + y.im \cdot \frac{y.im}{y.re}}} - \frac{x.re}{\frac{y.re \cdot y.re + y.im \cdot y.im}{y.im}} \]
      8. Taylor expanded in x.im around inf

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

          \[\leadsto \mathsf{/.f64}\left(x.im, \color{blue}{\left(y.re + \frac{{y.im}^{2}}{y.re}\right)}\right) \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \color{blue}{\left(\frac{{y.im}^{2}}{y.re}\right)}\right)\right) \]
        3. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{/.f64}\left(\left(y.im \cdot y.im\right), y.re\right)\right)\right) \]
        5. *-lowering-*.f6467.5%

          \[\leadsto \mathsf{/.f64}\left(x.im, \mathsf{+.f64}\left(y.re, \mathsf{/.f64}\left(\mathsf{*.f64}\left(y.im, y.im\right), y.re\right)\right)\right) \]
      10. Simplified67.5%

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

    Alternative 7: 63.6% accurate, 1.0× speedup?

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

      1. Initial program 49.5%

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

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

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

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

          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{x.re}{y.im}\right)}\right) \]
        4. /-lowering-/.f6466.8%

          \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(x.re, \color{blue}{y.im}\right)\right) \]
      5. Simplified66.8%

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

      if -1.7e-34 < y.im < 105000

      1. Initial program 73.3%

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      4. Step-by-step derivation
        1. /-lowering-/.f6466.6%

          \[\leadsto \mathsf{/.f64}\left(x.im, \color{blue}{y.re}\right) \]
      5. Simplified66.6%

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

    Alternative 8: 42.8% accurate, 5.0× speedup?

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

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

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

        \[\leadsto \mathsf{/.f64}\left(x.im, \color{blue}{y.re}\right) \]
    5. Simplified39.9%

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

    Reproduce

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