_divideComplex, imaginary part

Percentage Accurate: 62.0% → 81.6%
Time: 10.5s
Alternatives: 12
Speedup: 1.4×

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 12 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.0% 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: 81.6% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y.im \leq -8 \cdot 10^{-146}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y.im \leq 8.4 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 38.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(0 - x.re\right)\right)}{\mathsf{neg}\left(y.im\right)}} \]
      2. flip3--N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\mathsf{neg}\left(x.re\right)\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      7. sqr-powN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(0 + x.re\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      14. +-lft-identityN/A

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

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

        \[\leadsto \frac{\frac{\color{blue}{{0}^{3}} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      17. flip3--N/A

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
    10. Applied egg-rr90.7%

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

    if -5.7999999999999998e140 < y.im < -8.00000000000000021e-146 or 2.4000000000000002e-52 < y.im < 8.40000000000000046e124

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y.im, \frac{x.re}{0 - \mathsf{fma}\left(y.im, y.im, \color{blue}{y.re \cdot y.re}\right)}, \frac{x.im \cdot y.re}{{y.im}^{2} + {y.re}^{2}}\right) \]
      13. +-rgt-identityN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(y.im, \frac{x.re}{0 - \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, \color{blue}{\mathsf{fma}\left(y.re, \frac{x.im}{{y.im}^{2} + {y.re}^{2}}, 0\right)}\right) \]
    5. Simplified83.9%

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

    if -8.00000000000000021e-146 < y.im < 2.4000000000000002e-52

    1. Initial program 63.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. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.40000000000000046e124 < y.im

    1. Initial program 26.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} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -5.8 \cdot 10^{+140}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -8 \cdot 10^{-146}:\\ \;\;\;\;\mathsf{fma}\left(y.im, \frac{0 - x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, \mathsf{fma}\left(y.re, \frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, 0\right)\right)\\ \mathbf{elif}\;y.im \leq 2.4 \cdot 10^{-52}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 8.4 \cdot 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(y.im, \frac{0 - x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, \mathsf{fma}\left(y.re, \frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, 0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, 0 - x.re\right)}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 81.2% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 35.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} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left(\color{blue}{{x.re}^{\left(\frac{3}{2}\right)} \cdot {x.re}^{\left(\frac{3}{2}\right)}}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      6. pow-prod-downN/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left({\left(\left(0 - x.re\right) \cdot \color{blue}{\left(0 - x.re\right)}\right)}^{\left(\frac{3}{2}\right)}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      10. pow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}\right)\right)}{y.im} \]
      18. flip3--N/A

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

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

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

    if -1.4e115 < y.im < -1.15e-94

    1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15e-94 < y.im < 1.4e-14

    1. Initial program 62.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-14 < y.im

    1. Initial program 45.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.4 \cdot 10^{+115}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, 0 - x.re\right)}{y.im}\\ \mathbf{elif}\;y.im \leq -1.15 \cdot 10^{-94}:\\ \;\;\;\;\mathsf{fma}\left(y.im, \frac{0 - x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}, \frac{y.re \cdot x.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, 0 - x.re\right)}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 81.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -5.5 \cdot 10^{+115}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, 0 - x.re\right)}{y.im}\\ \mathbf{elif}\;y.im \leq -1.15 \cdot 10^{-94}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, 0 - x.re\right)}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -5.5e+115)
   (/ (fma x.im (/ y.re y.im) (- 0.0 x.re)) y.im)
   (if (<= y.im -1.15e-94)
     (/ (- (* y.re x.im) (* y.im x.re)) (fma y.re y.re (* y.im y.im)))
     (if (<= y.im 1.4e-14)
       (/ (- x.im (* x.re (/ y.im y.re))) y.re)
       (/ (fma y.re (/ x.im y.im) (- 0.0 x.re)) 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 <= -5.5e+115) {
		tmp = fma(x_46_im, (y_46_re / y_46_im), (0.0 - x_46_re)) / y_46_im;
	} else if (y_46_im <= -1.15e-94) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
	} else if (y_46_im <= 1.4e-14) {
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	} else {
		tmp = fma(y_46_re, (x_46_im / y_46_im), (0.0 - x_46_re)) / 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 <= -5.5e+115)
		tmp = Float64(fma(x_46_im, Float64(y_46_re / y_46_im), Float64(0.0 - x_46_re)) / y_46_im);
	elseif (y_46_im <= -1.15e-94)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im)));
	elseif (y_46_im <= 1.4e-14)
		tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re);
	else
		tmp = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(0.0 - x_46_re)) / 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, -5.5e+115], N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision] + N[(0.0 - x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -1.15e-94], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.4e-14], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + N[(0.0 - x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]]]
\begin{array}{l}

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

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

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

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


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

    1. Initial program 35.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} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left(\color{blue}{{x.re}^{\left(\frac{3}{2}\right)} \cdot {x.re}^{\left(\frac{3}{2}\right)}}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      6. pow-prod-downN/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left({\left(\left(0 - x.re\right) \cdot \color{blue}{\left(0 - x.re\right)}\right)}^{\left(\frac{3}{2}\right)}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      10. pow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}\right)\right)}{y.im} \]
      18. flip3--N/A

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

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

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

    if -5.5e115 < y.im < -1.15e-94

    1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

    if -1.15e-94 < y.im < 1.4e-14

    1. Initial program 62.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-14 < y.im

    1. Initial program 45.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -5.5 \cdot 10^{+115}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, 0 - x.re\right)}{y.im}\\ \mathbf{elif}\;y.im \leq -1.15 \cdot 10^{-94}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, 0 - x.re\right)}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 72.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -3.6 \cdot 10^{+96}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -75000000000:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -3.6e+96)
   (/ -1.0 (/ y.im x.re))
   (if (<= y.im -75000000000.0)
     (/ (- (* y.re x.im) (* y.im x.re)) (* y.im y.im))
     (if (<= y.im 1.4e-14)
       (/ (- x.im (* x.re (/ y.im y.re))) y.re)
       (- 0.0 (/ x.re 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 <= -3.6e+96) {
		tmp = -1.0 / (y_46_im / x_46_re);
	} else if (y_46_im <= -75000000000.0) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im);
	} else if (y_46_im <= 1.4e-14) {
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	} else {
		tmp = 0.0 - (x_46_re / 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 <= (-3.6d+96)) then
        tmp = (-1.0d0) / (y_46im / x_46re)
    else if (y_46im <= (-75000000000.0d0)) then
        tmp = ((y_46re * x_46im) - (y_46im * x_46re)) / (y_46im * y_46im)
    else if (y_46im <= 1.4d-14) then
        tmp = (x_46im - (x_46re * (y_46im / y_46re))) / y_46re
    else
        tmp = 0.0d0 - (x_46re / 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 <= -3.6e+96) {
		tmp = -1.0 / (y_46_im / x_46_re);
	} else if (y_46_im <= -75000000000.0) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im);
	} else if (y_46_im <= 1.4e-14) {
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	} else {
		tmp = 0.0 - (x_46_re / 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 <= -3.6e+96:
		tmp = -1.0 / (y_46_im / x_46_re)
	elif y_46_im <= -75000000000.0:
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im)
	elif y_46_im <= 1.4e-14:
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re
	else:
		tmp = 0.0 - (x_46_re / 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 <= -3.6e+96)
		tmp = Float64(-1.0 / Float64(y_46_im / x_46_re));
	elseif (y_46_im <= -75000000000.0)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(y_46_im * y_46_im));
	elseif (y_46_im <= 1.4e-14)
		tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re);
	else
		tmp = Float64(0.0 - Float64(x_46_re / 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 <= -3.6e+96)
		tmp = -1.0 / (y_46_im / x_46_re);
	elseif (y_46_im <= -75000000000.0)
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im);
	elseif (y_46_im <= 1.4e-14)
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	else
		tmp = 0.0 - (x_46_re / 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, -3.6e+96], N[(-1.0 / N[(y$46$im / x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -75000000000.0], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.4e-14], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(0.0 - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.6 \cdot 10^{+96}:\\
\;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\

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

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

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


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

    1. Initial program 40.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(0 - x.re\right)\right)}{\mathsf{neg}\left(y.im\right)}} \]
      2. flip3--N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\mathsf{neg}\left(x.re\right)\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      7. sqr-powN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(0 + x.re\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      14. +-lft-identityN/A

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

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

        \[\leadsto \frac{\frac{\color{blue}{{0}^{3}} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      17. flip3--N/A

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
    10. Applied egg-rr80.6%

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

    if -3.60000000000000013e96 < y.im < -7.5e10

    1. Initial program 82.1%

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

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

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

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

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

    if -7.5e10 < y.im < 1.4e-14

    1. Initial program 66.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. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-14 < y.im

    1. Initial program 45.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    9. Step-by-step derivation
      1. +-lft-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(0 + x.re\right)\right)}}{y.im} \]
      4. +-lft-identity72.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -3.6 \cdot 10^{+96}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -75000000000:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 78.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2.5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, 0 - x.re\right)}{y.im}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im - x.re \cdot \frac{y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, 0 - x.re\right)}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -2.5e+15)
   (/ (fma x.im (/ y.re y.im) (- 0.0 x.re)) y.im)
   (if (<= y.im 1.4e-14)
     (/ (- x.im (* x.re (/ y.im y.re))) y.re)
     (/ (fma y.re (/ x.im y.im) (- 0.0 x.re)) 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 <= -2.5e+15) {
		tmp = fma(x_46_im, (y_46_re / y_46_im), (0.0 - x_46_re)) / y_46_im;
	} else if (y_46_im <= 1.4e-14) {
		tmp = (x_46_im - (x_46_re * (y_46_im / y_46_re))) / y_46_re;
	} else {
		tmp = fma(y_46_re, (x_46_im / y_46_im), (0.0 - x_46_re)) / 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 <= -2.5e+15)
		tmp = Float64(fma(x_46_im, Float64(y_46_re / y_46_im), Float64(0.0 - x_46_re)) / y_46_im);
	elseif (y_46_im <= 1.4e-14)
		tmp = Float64(Float64(x_46_im - Float64(x_46_re * Float64(y_46_im / y_46_re))) / y_46_re);
	else
		tmp = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(0.0 - x_46_re)) / 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, -2.5e+15], N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision] + N[(0.0 - x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.4e-14], N[(N[(x$46$im - N[(x$46$re * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + N[(0.0 - x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -2.5e15

    1. Initial program 52.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left(\color{blue}{{x.re}^{\left(\frac{3}{2}\right)} \cdot {x.re}^{\left(\frac{3}{2}\right)}}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      6. pow-prod-downN/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left({\left(\left(0 - x.re\right) \cdot \color{blue}{\left(0 - x.re\right)}\right)}^{\left(\frac{3}{2}\right)}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      10. pow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}\right)\right)}{y.im} \]
      18. flip3--N/A

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

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

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

    if -2.5e15 < y.im < 1.4e-14

    1. Initial program 66.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. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-14 < y.im

    1. Initial program 45.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 78.2% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -2.5e15 or 1.09999999999999993e-15 < y.im

    1. Initial program 48.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left(\color{blue}{{x.re}^{\left(\frac{3}{2}\right)} \cdot {x.re}^{\left(\frac{3}{2}\right)}}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      6. pow-prod-downN/A

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \left(\mathsf{neg}\left({\left(\left(0 - x.re\right) \cdot \color{blue}{\left(0 - x.re\right)}\right)}^{\left(\frac{3}{2}\right)}\right)\right) \cdot \frac{1}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}\right)}{y.im} \]
      10. pow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x.im, \frac{y.re}{y.im}, \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}\right)\right)}{y.im} \]
      18. flip3--N/A

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

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

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

    if -2.5e15 < y.im < 1.09999999999999993e-15

    1. Initial program 66.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. /-lowering-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 64.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2.5 \cdot 10^{+89}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;x.re \cdot \frac{0 - y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -2.5e+89)
   (/ -1.0 (/ y.im x.re))
   (if (<= y.im -2e-83)
     (* x.re (/ (- 0.0 y.im) (fma y.re y.re (* y.im y.im))))
     (if (<= y.im 1.4e-14) (/ x.im y.re) (- 0.0 (/ x.re 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 <= -2.5e+89) {
		tmp = -1.0 / (y_46_im / x_46_re);
	} else if (y_46_im <= -2e-83) {
		tmp = x_46_re * ((0.0 - y_46_im) / fma(y_46_re, y_46_re, (y_46_im * y_46_im)));
	} else if (y_46_im <= 1.4e-14) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = 0.0 - (x_46_re / 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 <= -2.5e+89)
		tmp = Float64(-1.0 / Float64(y_46_im / x_46_re));
	elseif (y_46_im <= -2e-83)
		tmp = Float64(x_46_re * Float64(Float64(0.0 - y_46_im) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))));
	elseif (y_46_im <= 1.4e-14)
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = Float64(0.0 - Float64(x_46_re / 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, -2.5e+89], N[(-1.0 / N[(y$46$im / x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -2e-83], N[(x$46$re * N[(N[(0.0 - y$46$im), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.4e-14], N[(x$46$im / y$46$re), $MachinePrecision], N[(0.0 - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.5 \cdot 10^{+89}:\\
\;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\

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

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

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


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

    1. Initial program 41.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(0 - x.re\right)\right)}{\mathsf{neg}\left(y.im\right)}} \]
      2. flip3--N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\mathsf{neg}\left(x.re\right)\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      7. sqr-powN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(0 + x.re\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      14. +-lft-identityN/A

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

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

        \[\leadsto \frac{\frac{\color{blue}{{0}^{3}} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      17. flip3--N/A

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
    10. Applied egg-rr81.1%

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

    if -2.49999999999999992e89 < y.im < -2.0000000000000001e-83

    1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(y.im, \frac{x.re}{0 - \mathsf{fma}\left(y.im, y.im, \color{blue}{y.re \cdot y.re}\right)}, \frac{x.im \cdot y.re}{{y.im}^{2} + {y.re}^{2}}\right) \]
      13. +-rgt-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-83 < y.im < 1.4e-14

    1. Initial program 62.6%

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

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

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

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

    if 1.4e-14 < y.im

    1. Initial program 45.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    9. Step-by-step derivation
      1. +-lft-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(0 + x.re\right)\right)}}{y.im} \]
      4. +-lft-identity72.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.5 \cdot 10^{+89}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;x.re \cdot \frac{0 - y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 64.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2.6 \cdot 10^{+89}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -2.6e+89)
   (/ -1.0 (/ y.im x.re))
   (if (<= y.im -2e-83)
     (/ (- (* y.re x.im) (* y.im x.re)) (* y.im y.im))
     (if (<= y.im 1.4e-14) (/ x.im y.re) (- 0.0 (/ x.re 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 <= -2.6e+89) {
		tmp = -1.0 / (y_46_im / x_46_re);
	} else if (y_46_im <= -2e-83) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im);
	} else if (y_46_im <= 1.4e-14) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = 0.0 - (x_46_re / 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 <= (-2.6d+89)) then
        tmp = (-1.0d0) / (y_46im / x_46re)
    else if (y_46im <= (-2d-83)) then
        tmp = ((y_46re * x_46im) - (y_46im * x_46re)) / (y_46im * y_46im)
    else if (y_46im <= 1.4d-14) then
        tmp = x_46im / y_46re
    else
        tmp = 0.0d0 - (x_46re / 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 <= -2.6e+89) {
		tmp = -1.0 / (y_46_im / x_46_re);
	} else if (y_46_im <= -2e-83) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im);
	} else if (y_46_im <= 1.4e-14) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = 0.0 - (x_46_re / 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 <= -2.6e+89:
		tmp = -1.0 / (y_46_im / x_46_re)
	elif y_46_im <= -2e-83:
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im)
	elif y_46_im <= 1.4e-14:
		tmp = x_46_im / y_46_re
	else:
		tmp = 0.0 - (x_46_re / 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 <= -2.6e+89)
		tmp = Float64(-1.0 / Float64(y_46_im / x_46_re));
	elseif (y_46_im <= -2e-83)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(y_46_im * y_46_im));
	elseif (y_46_im <= 1.4e-14)
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = Float64(0.0 - Float64(x_46_re / 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 <= -2.6e+89)
		tmp = -1.0 / (y_46_im / x_46_re);
	elseif (y_46_im <= -2e-83)
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / (y_46_im * y_46_im);
	elseif (y_46_im <= 1.4e-14)
		tmp = x_46_im / y_46_re;
	else
		tmp = 0.0 - (x_46_re / 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, -2.6e+89], N[(-1.0 / N[(y$46$im / x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -2e-83], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.4e-14], N[(x$46$im / y$46$re), $MachinePrecision], N[(0.0 - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.6 \cdot 10^{+89}:\\
\;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\

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

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

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


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

    1. Initial program 40.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(0 - x.re\right)\right)}{\mathsf{neg}\left(y.im\right)}} \]
      2. flip3--N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\mathsf{neg}\left(x.re\right)\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      7. sqr-powN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(0 + x.re\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      14. +-lft-identityN/A

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

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

        \[\leadsto \frac{\frac{\color{blue}{{0}^{3}} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      17. flip3--N/A

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
    10. Applied egg-rr80.6%

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

    if -2.6000000000000001e89 < y.im < -2.0000000000000001e-83

    1. Initial program 82.0%

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

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

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

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

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

    if -2.0000000000000001e-83 < y.im < 1.4e-14

    1. Initial program 62.6%

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

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

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

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

    if 1.4e-14 < y.im

    1. Initial program 45.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    9. Step-by-step derivation
      1. +-lft-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(0 + x.re\right)\right)}}{y.im} \]
      4. +-lft-identity72.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.6 \cdot 10^{+89}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 62.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -2e-83)
   (/ -1.0 (/ y.im x.re))
   (if (<= y.im 1.4e-14) (/ x.im y.re) (- 0.0 (/ x.re 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 <= -2e-83) {
		tmp = -1.0 / (y_46_im / x_46_re);
	} else if (y_46_im <= 1.4e-14) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = 0.0 - (x_46_re / 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 <= (-2d-83)) then
        tmp = (-1.0d0) / (y_46im / x_46re)
    else if (y_46im <= 1.4d-14) then
        tmp = x_46im / y_46re
    else
        tmp = 0.0d0 - (x_46re / 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 <= -2e-83) {
		tmp = -1.0 / (y_46_im / x_46_re);
	} else if (y_46_im <= 1.4e-14) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = 0.0 - (x_46_re / 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 <= -2e-83:
		tmp = -1.0 / (y_46_im / x_46_re)
	elif y_46_im <= 1.4e-14:
		tmp = x_46_im / y_46_re
	else:
		tmp = 0.0 - (x_46_re / 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 <= -2e-83)
		tmp = Float64(-1.0 / Float64(y_46_im / x_46_re));
	elseif (y_46_im <= 1.4e-14)
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = Float64(0.0 - Float64(x_46_re / 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 <= -2e-83)
		tmp = -1.0 / (y_46_im / x_46_re);
	elseif (y_46_im <= 1.4e-14)
		tmp = x_46_im / y_46_re;
	else
		tmp = 0.0 - (x_46_re / 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, -2e-83], N[(-1.0 / N[(y$46$im / x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.4e-14], N[(x$46$im / y$46$re), $MachinePrecision], N[(0.0 - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2 \cdot 10^{-83}:\\
\;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -2.0000000000000001e-83

    1. Initial program 61.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(0 - x.re\right)\right)}{\mathsf{neg}\left(y.im\right)}} \]
      2. flip3--N/A

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\mathsf{neg}\left(x.re\right)\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      7. sqr-powN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(0 + x.re\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      14. +-lft-identityN/A

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

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

        \[\leadsto \frac{\frac{\color{blue}{{0}^{3}} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      17. flip3--N/A

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
    10. Applied egg-rr59.6%

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

    if -2.0000000000000001e-83 < y.im < 1.4e-14

    1. Initial program 62.6%

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

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

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

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

    if 1.4e-14 < y.im

    1. Initial program 45.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    9. Step-by-step derivation
      1. +-lft-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(0 + x.re\right)\right)}}{y.im} \]
      4. +-lft-identity72.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;\frac{-1}{\frac{y.im}{x.re}}\\ \mathbf{elif}\;y.im \leq 1.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 62.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0 - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-15}:\\ \;\;\;\;\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 -2e-83) t_0 (if (<= y.im 1.1e-15) (/ 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 <= -2e-83) {
		tmp = t_0;
	} else if (y_46_im <= 1.1e-15) {
		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 <= (-2d-83)) then
        tmp = t_0
    else if (y_46im <= 1.1d-15) 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 <= -2e-83) {
		tmp = t_0;
	} else if (y_46_im <= 1.1e-15) {
		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 <= -2e-83:
		tmp = t_0
	elif y_46_im <= 1.1e-15:
		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 <= -2e-83)
		tmp = t_0;
	elseif (y_46_im <= 1.1e-15)
		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 <= -2e-83)
		tmp = t_0;
	elseif (y_46_im <= 1.1e-15)
		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, -2e-83], t$95$0, If[LessEqual[y$46$im, 1.1e-15], 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 -2 \cdot 10^{-83}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -2.0000000000000001e-83 or 1.09999999999999993e-15 < y.im

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot x.re}}{y.im} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{y.im} \]
      2. neg-sub0N/A

        \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
      3. --lowering--.f6465.6

        \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    8. Simplified65.6%

      \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    9. Step-by-step derivation
      1. +-lft-identityN/A

        \[\leadsto \frac{0 - \color{blue}{\left(0 + x.re\right)}}{y.im} \]
      2. sub0-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(0 + x.re\right)\right)}}{y.im} \]
      3. neg-lowering-neg.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(0 + x.re\right)\right)}}{y.im} \]
      4. +-lft-identity65.6

        \[\leadsto \frac{-\color{blue}{x.re}}{y.im} \]
    10. Applied egg-rr65.6%

      \[\leadsto \frac{\color{blue}{-x.re}}{y.im} \]

    if -2.0000000000000001e-83 < y.im < 1.09999999999999993e-15

    1. Initial program 62.6%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6470.5

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    5. Simplified70.5%

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2 \cdot 10^{-83}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-15}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;0 - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 46.2% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+218}:\\ \;\;\;\;\frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 2.6 \cdot 10^{+174}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -4.2e+218)
   (/ x.re y.im)
   (if (<= y.im 2.6e+174) (/ x.im y.re) (/ x.re 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 <= -4.2e+218) {
		tmp = x_46_re / y_46_im;
	} else if (y_46_im <= 2.6e+174) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = x_46_re / 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 <= (-4.2d+218)) then
        tmp = x_46re / y_46im
    else if (y_46im <= 2.6d+174) then
        tmp = x_46im / y_46re
    else
        tmp = x_46re / 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 <= -4.2e+218) {
		tmp = x_46_re / y_46_im;
	} else if (y_46_im <= 2.6e+174) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = x_46_re / 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 <= -4.2e+218:
		tmp = x_46_re / y_46_im
	elif y_46_im <= 2.6e+174:
		tmp = x_46_im / y_46_re
	else:
		tmp = x_46_re / 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 <= -4.2e+218)
		tmp = Float64(x_46_re / y_46_im);
	elseif (y_46_im <= 2.6e+174)
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = Float64(x_46_re / 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 <= -4.2e+218)
		tmp = x_46_re / y_46_im;
	elseif (y_46_im <= 2.6e+174)
		tmp = x_46_im / y_46_re;
	else
		tmp = x_46_re / 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, -4.2e+218], N[(x$46$re / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.6e+174], N[(x$46$im / y$46$re), $MachinePrecision], N[(x$46$re / y$46$im), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -4.2 \cdot 10^{+218}:\\
\;\;\;\;\frac{x.re}{y.im}\\

\mathbf{elif}\;y.im \leq 2.6 \cdot 10^{+174}:\\
\;\;\;\;\frac{x.im}{y.re}\\

\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.im}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -4.1999999999999998e218 or 2.5999999999999999e174 < y.im

    1. Initial program 30.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 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 \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{x.re}{y.im}\right)\right)} \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. unpow2N/A

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      5. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      6. div-subN/A

        \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
      8. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + \left(\mathsf{neg}\left(x.re\right)\right)}}{y.im} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{y.re \cdot x.im}}{y.im} + \left(\mathsf{neg}\left(x.re\right)\right)}{y.im} \]
      10. associate-/l*N/A

        \[\leadsto \frac{\color{blue}{y.re \cdot \frac{x.im}{y.im}} + \left(\mathsf{neg}\left(x.re\right)\right)}{y.im} \]
      11. mul-1-negN/A

        \[\leadsto \frac{y.re \cdot \frac{x.im}{y.im} + \color{blue}{-1 \cdot x.re}}{y.im} \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -1 \cdot x.re\right)}}{y.im} \]
      13. /-lowering-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(y.re, \color{blue}{\frac{x.im}{y.im}}, -1 \cdot x.re\right)}{y.im} \]
      14. mul-1-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
      15. neg-sub0N/A

        \[\leadsto \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, \color{blue}{0 - x.re}\right)}{y.im} \]
      16. --lowering--.f6498.2

        \[\leadsto \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, \color{blue}{0 - x.re}\right)}{y.im} \]
    5. Simplified98.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, 0 - x.re\right)}{y.im}} \]
    6. Taylor expanded in y.re around 0

      \[\leadsto \frac{\color{blue}{-1 \cdot x.re}}{y.im} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{y.im} \]
      2. neg-sub0N/A

        \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
      3. --lowering--.f6488.0

        \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    8. Simplified88.0%

      \[\leadsto \frac{\color{blue}{0 - x.re}}{y.im} \]
    9. Step-by-step derivation
      1. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(0 - x.re\right)\right)}{\mathsf{neg}\left(y.im\right)}} \]
      2. flip3--N/A

        \[\leadsto \frac{\mathsf{neg}\left(\color{blue}{\frac{{0}^{3} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}\right)}{\mathsf{neg}\left(y.im\right)} \]
      3. distribute-neg-fracN/A

        \[\leadsto \frac{\color{blue}{\frac{\mathsf{neg}\left(\left({0}^{3} - {x.re}^{3}\right)\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}}{\mathsf{neg}\left(y.im\right)} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\left(\color{blue}{0} - {x.re}^{3}\right)\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      5. sub0-negN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left({x.re}^{3}\right)\right)}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      6. cube-negN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\mathsf{neg}\left(x.re\right)\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      7. sqr-powN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\mathsf{neg}\left(x.re\right)\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(\mathsf{neg}\left(x.re\right)\right)}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      8. pow-prod-downN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot \left(\mathsf{neg}\left(x.re\right)\right)\right)}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      9. sqr-negN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left({\color{blue}{\left(x.re \cdot x.re\right)}}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      10. +-lft-identityN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left({\left(\color{blue}{\left(0 + x.re\right)} \cdot x.re\right)}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      11. +-lft-identityN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left({\left(\left(0 + x.re\right) \cdot \color{blue}{\left(0 + x.re\right)}\right)}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      12. pow-prod-downN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(0 + x.re\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(0 + x.re\right)}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      13. sqr-powN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{{\left(0 + x.re\right)}^{3}}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      14. +-lft-identityN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left({\color{blue}{x.re}}^{3}\right)}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      15. sub0-negN/A

        \[\leadsto \frac{\frac{\color{blue}{0 - {x.re}^{3}}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      16. metadata-evalN/A

        \[\leadsto \frac{\frac{\color{blue}{{0}^{3}} - {x.re}^{3}}{0 \cdot 0 + \left(x.re \cdot x.re + 0 \cdot x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
      17. flip3--N/A

        \[\leadsto \frac{\color{blue}{0 - x.re}}{\mathsf{neg}\left(y.im\right)} \]
      18. neg-sub0N/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x.re\right)}}{\mathsf{neg}\left(y.im\right)} \]
    10. Applied egg-rr32.0%

      \[\leadsto \color{blue}{\frac{x.re}{y.im}} \]

    if -4.1999999999999998e218 < y.im < 2.5999999999999999e174

    1. Initial program 64.0%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    4. Step-by-step derivation
      1. /-lowering-/.f6448.2

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    5. Simplified48.2%

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 42.6% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \frac{x.im}{y.re} \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return x_46_im / y_46_re;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = x_46im / y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return x_46_im / y_46_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(x_46_im / y_46_re)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = x_46_im / y_46_re;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im}{y.re}
\end{array}
Derivation
  1. Initial program 57.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.6

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  5. Simplified39.6%

    \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024194 
(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))))