_divideComplex, imaginary part

Percentage Accurate: 61.8% → 98.2%
Time: 19.3s
Alternatives: 17
Speedup: 1.1×

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 17 alternatives:

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

Initial Program: 61.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x.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: 98.2% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right) \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (fma
  (/ y.re (hypot y.re y.im))
  (/ x.im (hypot y.re y.im))
  (/ (* x.re (/ y.im (hypot y.im y.re))) (- (hypot y.im y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return fma((y_46_re / hypot(y_46_re, y_46_im)), (x_46_im / hypot(y_46_re, y_46_im)), ((x_46_re * (y_46_im / hypot(y_46_im, y_46_re))) / -hypot(y_46_im, y_46_re)));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return fma(Float64(y_46_re / hypot(y_46_re, y_46_im)), Float64(x_46_im / hypot(y_46_re, y_46_im)), Float64(Float64(x_46_re * Float64(y_46_im / hypot(y_46_im, y_46_re))) / Float64(-hypot(y_46_im, y_46_re))))
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$re * N[(y$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)
\end{array}
Derivation
  1. Initial program 62.0%

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

      \[\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. *-commutative59.9%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
    10. hypot-define77.6%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
    11. associate-/l*81.7%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
    13. add-sqr-sqrt81.7%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
    14. pow281.7%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
  5. Step-by-step derivation
    1. *-un-lft-identity81.7%

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    5. +-commutative81.7%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    6. hypot-define97.0%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
    8. +-commutative81.7%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
    9. hypot-define97.0%

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

    \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
  7. Step-by-step derivation
    1. associate-*l/97.0%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    2. *-un-lft-identity97.0%

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

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

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

    \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\color{blue}{\frac{x.re \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
  11. Final simplification98.6%

    \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.re \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right) \]
  12. Add Preprocessing

Alternative 2: 92.1% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_1 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_2 := \mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{y.im}{-{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\ \mathbf{if}\;y.im \leq -5 \cdot 10^{+149}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \left(\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{1}{y.im}\right)\right)\\ \mathbf{elif}\;y.im \leq -1.02 \cdot 10^{-227}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y.im \leq 5.1 \cdot 10^{-241}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{\frac{y.im}{y.re}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq 4.3 \cdot 10^{+136}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ y.re (hypot y.re y.im)))
        (t_1 (/ x.im (hypot y.re y.im)))
        (t_2 (fma t_0 t_1 (* x.re (/ y.im (- (pow (hypot y.re y.im) 2.0)))))))
   (if (<= y.im -5e+149)
     (fma t_0 t_1 (* x.re (* (/ y.im (hypot y.im y.re)) (/ 1.0 y.im))))
     (if (<= y.im -1.02e-227)
       t_2
       (if (<= y.im 5.1e-241)
         (fma t_0 t_1 (* x.re (/ (/ y.im y.re) (- (hypot y.im y.re)))))
         (if (<= y.im 4.3e+136)
           t_2
           (fma t_0 t_1 (* x.re (/ -1.0 (hypot y.im y.re))))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_re / hypot(y_46_re, y_46_im);
	double t_1 = x_46_im / hypot(y_46_re, y_46_im);
	double t_2 = fma(t_0, t_1, (x_46_re * (y_46_im / -pow(hypot(y_46_re, y_46_im), 2.0))));
	double tmp;
	if (y_46_im <= -5e+149) {
		tmp = fma(t_0, t_1, (x_46_re * ((y_46_im / hypot(y_46_im, y_46_re)) * (1.0 / y_46_im))));
	} else if (y_46_im <= -1.02e-227) {
		tmp = t_2;
	} else if (y_46_im <= 5.1e-241) {
		tmp = fma(t_0, t_1, (x_46_re * ((y_46_im / y_46_re) / -hypot(y_46_im, y_46_re))));
	} else if (y_46_im <= 4.3e+136) {
		tmp = t_2;
	} else {
		tmp = fma(t_0, t_1, (x_46_re * (-1.0 / hypot(y_46_im, y_46_re))));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(y_46_re / hypot(y_46_re, y_46_im))
	t_1 = Float64(x_46_im / hypot(y_46_re, y_46_im))
	t_2 = fma(t_0, t_1, Float64(x_46_re * Float64(y_46_im / Float64(-(hypot(y_46_re, y_46_im) ^ 2.0)))))
	tmp = 0.0
	if (y_46_im <= -5e+149)
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(Float64(y_46_im / hypot(y_46_im, y_46_re)) * Float64(1.0 / y_46_im))));
	elseif (y_46_im <= -1.02e-227)
		tmp = t_2;
	elseif (y_46_im <= 5.1e-241)
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(Float64(y_46_im / y_46_re) / Float64(-hypot(y_46_im, y_46_re)))));
	elseif (y_46_im <= 4.3e+136)
		tmp = t_2;
	else
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(-1.0 / hypot(y_46_im, y_46_re))));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1 + N[(x$46$re * N[(y$46$im / (-N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -5e+149], N[(t$95$0 * t$95$1 + N[(x$46$re * N[(N[(y$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -1.02e-227], t$95$2, If[LessEqual[y$46$im, 5.1e-241], N[(t$95$0 * t$95$1 + N[(x$46$re * N[(N[(y$46$im / y$46$re), $MachinePrecision] / (-N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.3e+136], t$95$2, N[(t$95$0 * t$95$1 + N[(x$46$re * N[(-1.0 / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.im \leq -1.02 \cdot 10^{-227}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y.im \leq 5.1 \cdot 10^{-241}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{\frac{y.im}{y.re}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)\\

\mathbf{elif}\;y.im \leq 4.3 \cdot 10^{+136}:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 43.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. Step-by-step derivation
      1. div-sub43.1%

        \[\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. *-commutative43.1%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define43.1%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define49.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*53.6%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt53.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow253.6%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity53.6%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative53.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define96.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative53.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define96.8%

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

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

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

    if -4.9999999999999999e149 < y.im < -1.02e-227 or 5.0999999999999998e-241 < y.im < 4.2999999999999999e136

    1. Initial program 72.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-sub70.4%

        \[\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. *-commutative70.4%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define70.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define89.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*95.3%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt95.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow295.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr95.3%

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

    if -1.02e-227 < y.im < 5.0999999999999998e-241

    1. Initial program 59.7%

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

        \[\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. *-commutative53.6%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define80.5%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*78.2%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt78.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow278.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr78.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity78.2%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative78.3%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative78.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define94.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/94.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity94.6%

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

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

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

    if 4.2999999999999999e136 < y.im

    1. Initial program 38.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. Step-by-step derivation
      1. div-sub38.3%

        \[\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. *-commutative38.3%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define51.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*55.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity55.0%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define98.3%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define98.3%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/98.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity98.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \]
    8. Applied egg-rr98.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -5 \cdot 10^{+149}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \left(\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{1}{y.im}\right)\right)\\ \mathbf{elif}\;y.im \leq -1.02 \cdot 10^{-227}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{y.im}{-{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\ \mathbf{elif}\;y.im \leq 5.1 \cdot 10^{-241}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{\frac{y.im}{y.re}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq 4.3 \cdot 10^{+136}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{y.im}{-{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 92.1% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_1 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{if}\;y.im \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \left(\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{1}{y.im}\right)\right)\\ \mathbf{elif}\;y.im \leq -5 \cdot 10^{-227}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{y.im}{-{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\ \mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-240}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{\frac{y.im}{y.re}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+155}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \left(y.im \cdot \left(-{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ y.re (hypot y.re y.im))) (t_1 (/ x.im (hypot y.re y.im))))
   (if (<= y.im -5e+154)
     (fma t_0 t_1 (* x.re (* (/ y.im (hypot y.im y.re)) (/ 1.0 y.im))))
     (if (<= y.im -5e-227)
       (fma t_0 t_1 (* x.re (/ y.im (- (pow (hypot y.re y.im) 2.0)))))
       (if (<= y.im 1.1e-240)
         (fma t_0 t_1 (* x.re (/ (/ y.im y.re) (- (hypot y.im y.re)))))
         (if (<= y.im 1.65e+155)
           (fma t_0 t_1 (* x.re (* y.im (- (pow (hypot y.im y.re) -2.0)))))
           (fma t_0 t_1 (* x.re (/ -1.0 (hypot y.im y.re))))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = y_46_re / hypot(y_46_re, y_46_im);
	double t_1 = x_46_im / hypot(y_46_re, y_46_im);
	double tmp;
	if (y_46_im <= -5e+154) {
		tmp = fma(t_0, t_1, (x_46_re * ((y_46_im / hypot(y_46_im, y_46_re)) * (1.0 / y_46_im))));
	} else if (y_46_im <= -5e-227) {
		tmp = fma(t_0, t_1, (x_46_re * (y_46_im / -pow(hypot(y_46_re, y_46_im), 2.0))));
	} else if (y_46_im <= 1.1e-240) {
		tmp = fma(t_0, t_1, (x_46_re * ((y_46_im / y_46_re) / -hypot(y_46_im, y_46_re))));
	} else if (y_46_im <= 1.65e+155) {
		tmp = fma(t_0, t_1, (x_46_re * (y_46_im * -pow(hypot(y_46_im, y_46_re), -2.0))));
	} else {
		tmp = fma(t_0, t_1, (x_46_re * (-1.0 / hypot(y_46_im, y_46_re))));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(y_46_re / hypot(y_46_re, y_46_im))
	t_1 = Float64(x_46_im / hypot(y_46_re, y_46_im))
	tmp = 0.0
	if (y_46_im <= -5e+154)
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(Float64(y_46_im / hypot(y_46_im, y_46_re)) * Float64(1.0 / y_46_im))));
	elseif (y_46_im <= -5e-227)
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(y_46_im / Float64(-(hypot(y_46_re, y_46_im) ^ 2.0)))));
	elseif (y_46_im <= 1.1e-240)
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(Float64(y_46_im / y_46_re) / Float64(-hypot(y_46_im, y_46_re)))));
	elseif (y_46_im <= 1.65e+155)
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(y_46_im * Float64(-(hypot(y_46_im, y_46_re) ^ -2.0)))));
	else
		tmp = fma(t_0, t_1, Float64(x_46_re * Float64(-1.0 / hypot(y_46_im, y_46_re))));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -5e+154], N[(t$95$0 * t$95$1 + N[(x$46$re * N[(N[(y$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -5e-227], N[(t$95$0 * t$95$1 + N[(x$46$re * N[(y$46$im / (-N[Power[N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision], 2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.1e-240], N[(t$95$0 * t$95$1 + N[(x$46$re * N[(N[(y$46$im / y$46$re), $MachinePrecision] / (-N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.65e+155], N[(t$95$0 * t$95$1 + N[(x$46$re * N[(y$46$im * (-N[Power[N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision], -2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$1 + N[(x$46$re * N[(-1.0 / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.im \leq -5 \cdot 10^{-227}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{y.im}{-{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\

\mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-240}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \frac{\frac{y.im}{y.re}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)\\

\mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+155}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_1, x.re \cdot \left(y.im \cdot \left(-{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2}\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.im < -5.00000000000000004e154

    1. Initial program 43.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. Step-by-step derivation
      1. div-sub43.1%

        \[\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. *-commutative43.1%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define43.1%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define49.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*53.6%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt53.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow253.6%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity53.6%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative53.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define96.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative53.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define96.8%

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

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

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

    if -5.00000000000000004e154 < y.im < -4.99999999999999961e-227

    1. Initial program 73.2%

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

        \[\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. *-commutative71.0%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define71.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define91.5%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*95.7%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt95.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow295.7%

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

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

    if -4.99999999999999961e-227 < y.im < 1.1e-240

    1. Initial program 59.7%

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

        \[\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. *-commutative53.6%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define80.5%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*78.2%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt78.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow278.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr78.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity78.2%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative78.3%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative78.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define94.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/94.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity94.6%

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

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

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

    if 1.1e-240 < y.im < 1.6499999999999999e155

    1. Initial program 69.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. div-sub67.9%

        \[\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. *-commutative67.9%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define85.5%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*95.0%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt94.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow294.9%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. add-log-exp55.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\color{blue}{\log \left(e^{x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}}\right)}\right) \]
      2. exp-prod50.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\log \color{blue}{\left({\left(e^{x.re}\right)}^{\left(\frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)}\right)}\right) \]
      3. div-inv50.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\log \left({\left(e^{x.re}\right)}^{\color{blue}{\left(y.im \cdot \frac{1}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)}}\right)\right) \]
      4. pow-flip50.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\log \left({\left(e^{x.re}\right)}^{\left(y.im \cdot \color{blue}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{\left(-2\right)}}\right)}\right)\right) \]
      5. hypot-undefine50.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\log \left({\left(e^{x.re}\right)}^{\left(y.im \cdot {\color{blue}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^{\left(-2\right)}\right)}\right)\right) \]
      6. +-commutative50.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\log \left({\left(e^{x.re}\right)}^{\left(y.im \cdot {\left(\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}\right)}^{\left(-2\right)}\right)}\right)\right) \]
      7. hypot-define50.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\log \left({\left(e^{x.re}\right)}^{\left(y.im \cdot {\color{blue}{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}}^{\left(-2\right)}\right)}\right)\right) \]
      8. metadata-eval50.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\log \left({\left(e^{x.re}\right)}^{\left(y.im \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{\color{blue}{-2}}\right)}\right)\right) \]
    6. Applied egg-rr50.7%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\color{blue}{\log \left({\left(e^{x.re}\right)}^{\left(y.im \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2}\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. log-pow38.4%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -\color{blue}{\left(y.im \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2}\right) \cdot \log \left(e^{x.re}\right)}\right) \]
      2. rem-log-exp95.0%

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

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

    if 1.6499999999999999e155 < y.im

    1. Initial program 38.4%

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

        \[\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. *-commutative38.4%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define38.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define49.8%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*51.2%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt51.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow251.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr51.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity51.2%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative51.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define98.2%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative51.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define98.2%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/98.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity98.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \left(\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{1}{y.im}\right)\right)\\ \mathbf{elif}\;y.im \leq -5 \cdot 10^{-227}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{y.im}{-{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)\\ \mathbf{elif}\;y.im \leq 1.1 \cdot 10^{-240}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{\frac{y.im}{y.re}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+155}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \left(y.im \cdot \left(-{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 96.1% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right) \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (fma
  (/ y.re (hypot y.re y.im))
  (/ x.im (hypot y.re y.im))
  (* x.re (/ (/ y.im (hypot y.im y.re)) (- (hypot y.im y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return fma((y_46_re / hypot(y_46_re, y_46_im)), (x_46_im / hypot(y_46_re, y_46_im)), (x_46_re * ((y_46_im / hypot(y_46_im, y_46_re)) / -hypot(y_46_im, y_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return fma(Float64(y_46_re / hypot(y_46_re, y_46_im)), Float64(x_46_im / hypot(y_46_re, y_46_im)), Float64(x_46_re * Float64(Float64(y_46_im / hypot(y_46_im, y_46_re)) / Float64(-hypot(y_46_im, y_46_re)))))
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] + N[(x$46$re * N[(N[(y$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] / (-N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right)
\end{array}
Derivation
  1. Initial program 62.0%

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

      \[\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. *-commutative59.9%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
    10. hypot-define77.6%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
    11. associate-/l*81.7%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
    13. add-sqr-sqrt81.7%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
    14. pow281.7%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
  5. Step-by-step derivation
    1. *-un-lft-identity81.7%

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    5. +-commutative81.7%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    6. hypot-define97.0%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
    8. +-commutative81.7%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
    9. hypot-define97.0%

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

    \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
  7. Step-by-step derivation
    1. associate-*l/97.0%

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    2. *-un-lft-identity97.0%

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

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

    \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{-\mathsf{hypot}\left(y.im, y.re\right)}\right) \]
  10. Add Preprocessing

Alternative 5: 82.5% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ t_1 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_2 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{if}\;y.im \leq -2.8 \cdot 10^{-82}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t\_2, x.re \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq -4.8 \cdot 10^{-228}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.65 \cdot 10^{-193}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \mathbf{elif}\;y.im \leq 0.0012:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t\_2, x.re \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (- (/ x.im y.re) (* x.re (/ y.im (pow y.re 2.0)))))
        (t_1 (/ y.re (hypot y.re y.im)))
        (t_2 (/ x.im (hypot y.re y.im))))
   (if (<= y.im -2.8e-82)
     (fma t_1 t_2 (* x.re (/ 1.0 (hypot y.im y.re))))
     (if (<= y.im -4.8e-228)
       t_0
       (if (<= y.im 1.65e-193)
         (/ (* x.im (/ y.re (hypot y.im y.re))) (hypot y.im y.re))
         (if (<= y.im 0.0012)
           t_0
           (fma t_1 t_2 (* x.re (/ -1.0 (hypot y.im y.re))))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im / y_46_re) - (x_46_re * (y_46_im / pow(y_46_re, 2.0)));
	double t_1 = y_46_re / hypot(y_46_re, y_46_im);
	double t_2 = x_46_im / hypot(y_46_re, y_46_im);
	double tmp;
	if (y_46_im <= -2.8e-82) {
		tmp = fma(t_1, t_2, (x_46_re * (1.0 / hypot(y_46_im, y_46_re))));
	} else if (y_46_im <= -4.8e-228) {
		tmp = t_0;
	} else if (y_46_im <= 1.65e-193) {
		tmp = (x_46_im * (y_46_re / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re);
	} else if (y_46_im <= 0.0012) {
		tmp = t_0;
	} else {
		tmp = fma(t_1, t_2, (x_46_re * (-1.0 / hypot(y_46_im, y_46_re))));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re * Float64(y_46_im / (y_46_re ^ 2.0))))
	t_1 = Float64(y_46_re / hypot(y_46_re, y_46_im))
	t_2 = Float64(x_46_im / hypot(y_46_re, y_46_im))
	tmp = 0.0
	if (y_46_im <= -2.8e-82)
		tmp = fma(t_1, t_2, Float64(x_46_re * Float64(1.0 / hypot(y_46_im, y_46_re))));
	elseif (y_46_im <= -4.8e-228)
		tmp = t_0;
	elseif (y_46_im <= 1.65e-193)
		tmp = Float64(Float64(x_46_im * Float64(y_46_re / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re));
	elseif (y_46_im <= 0.0012)
		tmp = t_0;
	else
		tmp = fma(t_1, t_2, Float64(x_46_re * Float64(-1.0 / hypot(y_46_im, y_46_re))));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re * N[(y$46$im / N[Power[y$46$re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -2.8e-82], N[(t$95$1 * t$95$2 + N[(x$46$re * N[(1.0 / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -4.8e-228], t$95$0, If[LessEqual[y$46$im, 1.65e-193], N[(N[(x$46$im * N[(y$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 0.0012], t$95$0, N[(t$95$1 * t$95$2 + N[(x$46$re * N[(-1.0 / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\
t_1 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_2 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{if}\;y.im \leq -2.8 \cdot 10^{-82}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_2, x.re \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\

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

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

\mathbf{elif}\;y.im \leq 0.0012:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -2.80000000000000024e-82

    1. Initial program 61.7%

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

        \[\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. *-commutative61.7%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define75.0%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*80.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt80.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr80.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity80.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative80.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define96.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/96.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity96.7%

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

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

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

    if -2.80000000000000024e-82 < y.im < -4.80000000000000004e-228 or 1.6499999999999999e-193 < y.im < 0.00119999999999999989

    1. Initial program 70.5%

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

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg85.8%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg85.8%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*85.8%

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

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

    if -4.80000000000000004e-228 < y.im < 1.6499999999999999e-193

    1. Initial program 60.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. fma-define60.8%

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. add-sqr-sqrt51.9%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      3. hypot-undefine51.9%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      4. hypot-undefine51.9%

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

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

        \[\leadsto \frac{y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      7. +-commutative59.4%

        \[\leadsto \frac{y.re}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      8. hypot-define86.5%

        \[\leadsto \frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      9. hypot-undefine59.4%

        \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      10. +-commutative59.4%

        \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \]
      11. hypot-define86.5%

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

      \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}} \]
    10. Step-by-step derivation
      1. associate-*r/88.8%

        \[\leadsto \color{blue}{\frac{\frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.im}{\mathsf{hypot}\left(y.im, y.re\right)}} \]
    11. Applied egg-rr88.8%

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

    if 0.00119999999999999989 < y.im

    1. Initial program 55.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. Step-by-step derivation
      1. div-sub55.1%

        \[\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. *-commutative55.1%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define55.1%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define62.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*72.3%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow272.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr72.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity72.3%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define98.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define98.8%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/98.8%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity98.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.8 \cdot 10^{-82}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq -4.8 \cdot 10^{-228}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 1.65 \cdot 10^{-193}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \mathbf{elif}\;y.im \leq 0.0012:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 82.4% accurate, 0.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -5.49999999999999959e-119

    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. div-sub62.6%

        \[\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. *-commutative62.6%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define76.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*81.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt81.8%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity81.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative81.8%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define96.8%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define96.8%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/96.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity96.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \]
    8. Applied egg-rr96.9%

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

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

    if -5.49999999999999959e-119 < y.im < 0.045999999999999999

    1. Initial program 65.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. Step-by-step derivation
      1. div-sub60.4%

        \[\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. *-commutative60.4%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define60.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define88.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*87.9%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt87.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow287.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr87.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity87.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative87.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define96.0%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative87.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define96.0%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/96.0%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity96.0%

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

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

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

    if 0.045999999999999999 < y.im

    1. Initial program 55.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. Step-by-step derivation
      1. div-sub55.1%

        \[\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. *-commutative55.1%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define55.1%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define62.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*72.3%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow272.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr72.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity72.3%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define98.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define98.8%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/98.8%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity98.8%

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

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

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

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

Alternative 7: 82.3% accurate, 0.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -2.6999999999999999e-232

    1. Initial program 64.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. Step-by-step derivation
      1. div-sub63.2%

        \[\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. *-commutative63.2%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define80.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*84.3%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt84.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow284.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr84.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity84.3%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative84.3%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative84.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define97.6%

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

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

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

    if -2.6999999999999999e-232 < y.im < 0.0018

    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. div-sub57.9%

        \[\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. *-commutative57.9%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define87.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*86.0%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity86.0%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define93.9%

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/93.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity93.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \]
    8. Applied egg-rr93.9%

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

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

    if 0.0018 < y.im

    1. Initial program 55.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. Step-by-step derivation
      1. div-sub55.1%

        \[\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. *-commutative55.1%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define55.1%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define62.6%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*72.3%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow272.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr72.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity72.3%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. hypot-define98.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right)\right) \]
      8. +-commutative72.3%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define98.8%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/98.8%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity98.8%

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

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

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

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

Alternative 8: 82.2% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ t_1 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\ t_2 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\ \mathbf{if}\;y.im \leq -5.5 \cdot 10^{-85}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t\_2, x.re \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq -1.05 \cdot 10^{-227}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 8.5 \cdot 10^{-198}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-20}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+79}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t\_2, x.re \cdot \frac{-1}{y.im}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (- (/ x.im y.re) (* x.re (/ y.im (pow y.re 2.0)))))
        (t_1 (/ y.re (hypot y.re y.im)))
        (t_2 (/ x.im (hypot y.re y.im))))
   (if (<= y.im -5.5e-85)
     (fma t_1 t_2 (* x.re (/ 1.0 (hypot y.im y.re))))
     (if (<= y.im -1.05e-227)
       t_0
       (if (<= y.im 8.5e-198)
         (/ (* x.im (/ y.re (hypot y.im y.re))) (hypot y.im y.re))
         (if (<= y.im 4.5e-20)
           t_0
           (if (<= y.im 1.65e+79)
             (/
              (- (* y.re x.im) (* y.im x.re))
              (+ (* y.re y.re) (* y.im y.im)))
             (fma t_1 t_2 (* x.re (/ -1.0 y.im))))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im / y_46_re) - (x_46_re * (y_46_im / pow(y_46_re, 2.0)));
	double t_1 = y_46_re / hypot(y_46_re, y_46_im);
	double t_2 = x_46_im / hypot(y_46_re, y_46_im);
	double tmp;
	if (y_46_im <= -5.5e-85) {
		tmp = fma(t_1, t_2, (x_46_re * (1.0 / hypot(y_46_im, y_46_re))));
	} else if (y_46_im <= -1.05e-227) {
		tmp = t_0;
	} else if (y_46_im <= 8.5e-198) {
		tmp = (x_46_im * (y_46_re / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re);
	} else if (y_46_im <= 4.5e-20) {
		tmp = t_0;
	} else if (y_46_im <= 1.65e+79) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	} else {
		tmp = fma(t_1, t_2, (x_46_re * (-1.0 / y_46_im)));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re * Float64(y_46_im / (y_46_re ^ 2.0))))
	t_1 = Float64(y_46_re / hypot(y_46_re, y_46_im))
	t_2 = Float64(x_46_im / hypot(y_46_re, y_46_im))
	tmp = 0.0
	if (y_46_im <= -5.5e-85)
		tmp = fma(t_1, t_2, Float64(x_46_re * Float64(1.0 / hypot(y_46_im, y_46_re))));
	elseif (y_46_im <= -1.05e-227)
		tmp = t_0;
	elseif (y_46_im <= 8.5e-198)
		tmp = Float64(Float64(x_46_im * Float64(y_46_re / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re));
	elseif (y_46_im <= 4.5e-20)
		tmp = t_0;
	elseif (y_46_im <= 1.65e+79)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)));
	else
		tmp = fma(t_1, t_2, Float64(x_46_re * Float64(-1.0 / y_46_im)));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re * N[(y$46$im / N[Power[y$46$re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x$46$im / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -5.5e-85], N[(t$95$1 * t$95$2 + N[(x$46$re * N[(1.0 / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -1.05e-227], t$95$0, If[LessEqual[y$46$im, 8.5e-198], N[(N[(x$46$im * N[(y$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.5e-20], t$95$0, If[LessEqual[y$46$im, 1.65e+79], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$2 + N[(x$46$re * N[(-1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\
t_1 := \frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\
t_2 := \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{if}\;y.im \leq -5.5 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_2, x.re \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\

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

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

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

\mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+79}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.im < -5.4999999999999997e-85

    1. Initial program 61.7%

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

        \[\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. *-commutative61.7%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define75.0%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*80.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt80.8%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr80.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
    5. Step-by-step derivation
      1. *-un-lft-identity80.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{y.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. +-commutative80.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}}\right)\right) \]
      9. hypot-define96.6%

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right)}\right) \]
    7. Step-by-step derivation
      1. associate-*l/96.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \color{blue}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
      2. *-un-lft-identity96.7%

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

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

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

    if -5.4999999999999997e-85 < y.im < -1.05e-227 or 8.4999999999999994e-198 < y.im < 4.5000000000000001e-20

    1. Initial program 67.2%

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

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re} + -1 \cdot \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      2. mul-1-neg87.8%

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg87.8%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*87.8%

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

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

    if -1.05e-227 < y.im < 8.4999999999999994e-198

    1. Initial program 60.8%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. fma-define60.8%

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. add-sqr-sqrt51.9%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      3. hypot-undefine51.9%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      4. hypot-undefine51.9%

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

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

        \[\leadsto \frac{y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      7. +-commutative59.4%

        \[\leadsto \frac{y.re}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      8. hypot-define86.5%

        \[\leadsto \frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      9. hypot-undefine59.4%

        \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      10. +-commutative59.4%

        \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \]
      11. hypot-define86.5%

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

      \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}} \]
    10. Step-by-step derivation
      1. associate-*r/88.8%

        \[\leadsto \color{blue}{\frac{\frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.im}{\mathsf{hypot}\left(y.im, y.re\right)}} \]
    11. Applied egg-rr88.8%

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

    if 4.5000000000000001e-20 < y.im < 1.6500000000000001e79

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

    if 1.6500000000000001e79 < y.im

    1. Initial program 43.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. Step-by-step derivation
      1. div-sub43.8%

        \[\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. *-commutative43.8%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{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} \]
      3. fma-define43.8%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define53.2%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*65.4%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt65.4%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow265.4%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr65.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -5.5 \cdot 10^{-85}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)\\ \mathbf{elif}\;y.im \leq -1.05 \cdot 10^{-227}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 8.5 \cdot 10^{-198}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \mathbf{elif}\;y.im \leq 4.5 \cdot 10^{-20}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 1.65 \cdot 10^{+79}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{-1}{y.im}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 80.9% accurate, 0.0× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{-1}{y.im}\right)\\
\mathbf{if}\;y.im \leq -120:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;y.im \leq 1.05 \cdot 10^{+77}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -120 or 1.0499999999999999e77 < y.im

    1. Initial program 51.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. Step-by-step derivation
      1. div-sub51.9%

        \[\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. *-commutative51.9%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define62.4%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*71.9%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt71.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow271.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr71.9%

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

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

    if -120 < y.im < 1.5499999999999999e-19

    1. Initial program 66.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 80.5%

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

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

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg80.5%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*79.9%

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

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

    if 1.5499999999999999e-19 < y.im < 1.0499999999999999e77

    1. Initial program 99.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. Recombined 3 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -120:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{-1}{y.im}\right)\\ \mathbf{elif}\;y.im \leq 1.55 \cdot 10^{-19}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 1.05 \cdot 10^{+77}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, x.re \cdot \frac{-1}{y.im}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 79.1% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -2.2 \cdot 10^{+65}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq -2.1 \cdot 10^{-53}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \mathsf{fma}\left(x.re, -y.im, y.re \cdot x.im\right)\\ \mathbf{elif}\;y.im \leq 5.4 \cdot 10^{-20}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 3 \cdot 10^{+74}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (- (* y.re (* (/ 1.0 y.im) (/ x.im y.im))) (/ x.re y.im))))
   (if (<= y.im -2.2e+65)
     t_0
     (if (<= y.im -2.1e-53)
       (* (pow (hypot y.im y.re) -2.0) (fma x.re (- y.im) (* y.re x.im)))
       (if (<= y.im 5.4e-20)
         (- (/ x.im y.re) (* x.re (/ y.im (pow y.re 2.0))))
         (if (<= y.im 3e+74)
           (/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
           t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -2.2e+65) {
		tmp = t_0;
	} else if (y_46_im <= -2.1e-53) {
		tmp = pow(hypot(y_46_im, y_46_re), -2.0) * fma(x_46_re, -y_46_im, (y_46_re * x_46_im));
	} else if (y_46_im <= 5.4e-20) {
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / pow(y_46_re, 2.0)));
	} else if (y_46_im <= 3e+74) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(y_46_re * Float64(Float64(1.0 / y_46_im) * Float64(x_46_im / y_46_im))) - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -2.2e+65)
		tmp = t_0;
	elseif (y_46_im <= -2.1e-53)
		tmp = Float64((hypot(y_46_im, y_46_re) ^ -2.0) * fma(x_46_re, Float64(-y_46_im), Float64(y_46_re * x_46_im)));
	elseif (y_46_im <= 5.4e-20)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re * Float64(y_46_im / (y_46_re ^ 2.0))));
	elseif (y_46_im <= 3e+74)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)));
	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[(y$46$re * N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -2.2e+65], t$95$0, If[LessEqual[y$46$im, -2.1e-53], N[(N[Power[N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision], -2.0], $MachinePrecision] * N[(x$46$re * (-y$46$im) + N[(y$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 5.4e-20], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re * N[(y$46$im / N[Power[y$46$re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 3e+74], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.2 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\

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

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

\mathbf{elif}\;y.im \leq 3 \cdot 10^{+74}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -2.1999999999999998e65 or 3e74 < y.im

    1. Initial program 48.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 0 77.8%

      \[\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. +-commutative77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-neg77.8%

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]
      3. unsub-neg77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. *-commutative77.8%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      5. associate-/l*82.0%

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

      \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity82.0%

        \[\leadsto y.re \cdot \frac{\color{blue}{1 \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      2. unpow282.0%

        \[\leadsto y.re \cdot \frac{1 \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      3. times-frac85.3%

        \[\leadsto y.re \cdot \color{blue}{\left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right)} - \frac{x.re}{y.im} \]
    7. Applied egg-rr85.3%

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

    if -2.1999999999999998e65 < y.im < -2.09999999999999977e-53

    1. Initial program 77.7%

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

        \[\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. *-commutative77.7%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\sqrt{\color{blue}{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}\right) \]
      10. hypot-define90.7%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, -\frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right) \]
      11. associate-/l*93.9%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}\right) \]
      13. add-sqr-sqrt93.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot \sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}}}\right) \]
      14. pow293.9%

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)}, \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, -x.re \cdot \frac{y.im}{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\right)}^{2}}}\right) \]
    4. Applied egg-rr93.9%

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

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} + \left(-x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right)} \]
      2. frac-times77.8%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \mathsf{hypot}\left(y.re, y.im\right)}} + \left(-x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right) \]
      3. hypot-undefine77.7%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \mathsf{hypot}\left(y.re, y.im\right)} + \left(-x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right) \]
      4. hypot-undefine77.7%

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} + \left(-x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right) \]
      5. add-sqr-sqrt77.7%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} + \left(-x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right) \]
      6. fma-define77.8%

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} + \left(-x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right) \]
      8. sub-neg77.7%

        \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{y.re \cdot y.re + y.im \cdot y.im} - x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} \]
      9. add-sqr-sqrt77.7%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} - x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \]
      10. hypot-undefine77.7%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}} - x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \]
      11. hypot-undefine77.8%

        \[\leadsto \frac{y.re \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right) \cdot \color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}} - x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \]
      12. unpow277.8%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} - x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \]
      13. *-commutative77.8%

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re}}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - x.re \cdot \frac{y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} \]
      14. associate-*r/77.7%

        \[\leadsto \frac{x.im \cdot y.re}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}} - \color{blue}{\frac{x.re \cdot y.im}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}} \]
    6. Applied egg-rr46.0%

      \[\leadsto \color{blue}{\frac{\left(y.re \cdot x.im\right) \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} - {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{4}}} \]
    7. Step-by-step derivation
      1. *-commutative46.0%

        \[\leadsto \frac{\color{blue}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im\right)} - {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{4}} \]
      2. distribute-lft-out--46.0%

        \[\leadsto \frac{\color{blue}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{4}} \]
    8. Simplified46.0%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{4}}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity46.0%

        \[\leadsto \frac{\color{blue}{1 \cdot \left({\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)\right)}}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{4}} \]
      2. metadata-eval46.0%

        \[\leadsto \frac{1 \cdot \left({\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{\color{blue}{\left(2 + 2\right)}}} \]
      3. pow-prod-up45.8%

        \[\leadsto \frac{1 \cdot \left({\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)\right)}{\color{blue}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}} \]
      4. times-frac49.1%

        \[\leadsto \color{blue}{\frac{1}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}} \]
      5. metadata-eval49.1%

        \[\leadsto \frac{\color{blue}{1 \cdot 1}}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      6. unpow249.1%

        \[\leadsto \frac{1 \cdot 1}{\color{blue}{\mathsf{hypot}\left(y.im, y.re\right) \cdot \mathsf{hypot}\left(y.im, y.re\right)}} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      7. frac-times49.0%

        \[\leadsto \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right)} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      8. inv-pow49.0%

        \[\leadsto \left(\color{blue}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-1}} \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      9. inv-pow49.0%

        \[\leadsto \left({\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-1} \cdot \color{blue}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-1}}\right) \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      10. pow-prod-up49.1%

        \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{\left(-1 + -1\right)}} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      11. metadata-eval49.1%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{\color{blue}{-2}} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      12. *-commutative49.1%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - \color{blue}{x.re \cdot y.im}\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
    10. Applied egg-rr49.1%

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2} \cdot \left(y.re \cdot x.im - x.re \cdot y.im\right)}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}} \]
    11. Step-by-step derivation
      1. *-commutative49.1%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \frac{\color{blue}{\left(y.re \cdot x.im - x.re \cdot y.im\right) \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}} \]
      2. *-lft-identity49.1%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \frac{\left(y.re \cdot x.im - x.re \cdot y.im\right) \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}{\color{blue}{1 \cdot {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}} \]
      3. times-frac67.5%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \color{blue}{\left(\frac{y.re \cdot x.im - x.re \cdot y.im}{1} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}\right)} \]
      4. /-rgt-identity67.5%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \left(\color{blue}{\left(y.re \cdot x.im - x.re \cdot y.im\right)} \cdot \frac{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}{{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{2}}\right) \]
      5. *-inverses77.8%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \left(\left(y.re \cdot x.im - x.re \cdot y.im\right) \cdot \color{blue}{1}\right) \]
      6. *-rgt-identity77.8%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \color{blue}{\left(y.re \cdot x.im - x.re \cdot y.im\right)} \]
      7. sub-neg77.8%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \color{blue}{\left(y.re \cdot x.im + \left(-x.re \cdot y.im\right)\right)} \]
      8. +-commutative77.8%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \color{blue}{\left(\left(-x.re \cdot y.im\right) + y.re \cdot x.im\right)} \]
      9. distribute-rgt-neg-in77.8%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \left(\color{blue}{x.re \cdot \left(-y.im\right)} + y.re \cdot x.im\right) \]
      10. fma-define77.8%

        \[\leadsto {\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \color{blue}{\mathsf{fma}\left(x.re, -y.im, y.re \cdot x.im\right)} \]
    12. Simplified77.8%

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

    if -2.09999999999999977e-53 < y.im < 5.3999999999999999e-20

    1. Initial program 64.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 83.2%

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

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

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg83.2%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*82.4%

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

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

    if 5.3999999999999999e-20 < y.im < 3e74

    1. Initial program 99.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. Recombined 4 regimes into one program.
  4. Final simplification84.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.2 \cdot 10^{+65}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -2.1 \cdot 10^{-53}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(y.im, y.re\right)\right)}^{-2} \cdot \mathsf{fma}\left(x.re, -y.im, y.re \cdot x.im\right)\\ \mathbf{elif}\;y.im \leq 5.4 \cdot 10^{-20}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 3 \cdot 10^{+74}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 79.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ t_1 := y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -2.4 \cdot 10^{+65}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.im \leq -1.15 \cdot 10^{-49}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 4.1 \cdot 10^{-20}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 4.4 \cdot 10^{+76}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im))))
        (t_1 (- (* y.re (* (/ 1.0 y.im) (/ x.im y.im))) (/ x.re y.im))))
   (if (<= y.im -2.4e+65)
     t_1
     (if (<= y.im -1.15e-49)
       t_0
       (if (<= y.im 4.1e-20)
         (- (/ x.im y.re) (* x.re (/ y.im (pow y.re 2.0))))
         (if (<= y.im 4.4e+76) t_0 t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -2.4e+65) {
		tmp = t_1;
	} else if (y_46_im <= -1.15e-49) {
		tmp = t_0;
	} else if (y_46_im <= 4.1e-20) {
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / pow(y_46_re, 2.0)));
	} else if (y_46_im <= 4.4e+76) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
    t_1 = (y_46re * ((1.0d0 / y_46im) * (x_46im / y_46im))) - (x_46re / y_46im)
    if (y_46im <= (-2.4d+65)) then
        tmp = t_1
    else if (y_46im <= (-1.15d-49)) then
        tmp = t_0
    else if (y_46im <= 4.1d-20) then
        tmp = (x_46im / y_46re) - (x_46re * (y_46im / (y_46re ** 2.0d0)))
    else if (y_46im <= 4.4d+76) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -2.4e+65) {
		tmp = t_1;
	} else if (y_46_im <= -1.15e-49) {
		tmp = t_0;
	} else if (y_46_im <= 4.1e-20) {
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / Math.pow(y_46_re, 2.0)));
	} else if (y_46_im <= 4.4e+76) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	t_1 = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im)
	tmp = 0
	if y_46_im <= -2.4e+65:
		tmp = t_1
	elif y_46_im <= -1.15e-49:
		tmp = t_0
	elif y_46_im <= 4.1e-20:
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / math.pow(y_46_re, 2.0)))
	elif y_46_im <= 4.4e+76:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
	t_1 = Float64(Float64(y_46_re * Float64(Float64(1.0 / y_46_im) * Float64(x_46_im / y_46_im))) - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -2.4e+65)
		tmp = t_1;
	elseif (y_46_im <= -1.15e-49)
		tmp = t_0;
	elseif (y_46_im <= 4.1e-20)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re * Float64(y_46_im / (y_46_re ^ 2.0))));
	elseif (y_46_im <= 4.4e+76)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	t_1 = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im);
	tmp = 0.0;
	if (y_46_im <= -2.4e+65)
		tmp = t_1;
	elseif (y_46_im <= -1.15e-49)
		tmp = t_0;
	elseif (y_46_im <= 4.1e-20)
		tmp = (x_46_im / y_46_re) - (x_46_re * (y_46_im / (y_46_re ^ 2.0)));
	elseif (y_46_im <= 4.4e+76)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y$46$re * N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -2.4e+65], t$95$1, If[LessEqual[y$46$im, -1.15e-49], t$95$0, If[LessEqual[y$46$im, 4.1e-20], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(x$46$re * N[(y$46$im / N[Power[y$46$re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.4e+76], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -2.4000000000000002e65 or 4.4000000000000001e76 < y.im

    1. Initial program 48.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 0 77.8%

      \[\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. +-commutative77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-neg77.8%

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]
      3. unsub-neg77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. *-commutative77.8%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      5. associate-/l*82.0%

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

      \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity82.0%

        \[\leadsto y.re \cdot \frac{\color{blue}{1 \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      2. unpow282.0%

        \[\leadsto y.re \cdot \frac{1 \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      3. times-frac85.3%

        \[\leadsto y.re \cdot \color{blue}{\left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right)} - \frac{x.re}{y.im} \]
    7. Applied egg-rr85.3%

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

    if -2.4000000000000002e65 < y.im < -1.15e-49 or 4.1000000000000001e-20 < y.im < 4.4000000000000001e76

    1. Initial program 85.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing

    if -1.15e-49 < y.im < 4.1000000000000001e-20

    1. Initial program 64.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 83.2%

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

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

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg83.2%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*82.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.4 \cdot 10^{+65}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.15 \cdot 10^{-49}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 4.1 \cdot 10^{-20}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 4.4 \cdot 10^{+76}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 79.1% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := y.re \cdot x.im - y.im \cdot x.re\\
t_1 := y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.05 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\

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

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

\mathbf{elif}\;y.im \leq 7.6 \cdot 10^{+75}:\\
\;\;\;\;\frac{t\_0}{y.re \cdot y.re + y.im \cdot y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -1.04999999999999996e65 or 7.6000000000000005e75 < y.im

    1. Initial program 48.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 0 77.8%

      \[\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. +-commutative77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-neg77.8%

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]
      3. unsub-neg77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. *-commutative77.8%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      5. associate-/l*82.0%

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

      \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity82.0%

        \[\leadsto y.re \cdot \frac{\color{blue}{1 \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      2. unpow282.0%

        \[\leadsto y.re \cdot \frac{1 \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      3. times-frac85.3%

        \[\leadsto y.re \cdot \color{blue}{\left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right)} - \frac{x.re}{y.im} \]
    7. Applied egg-rr85.3%

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

    if -1.04999999999999996e65 < y.im < -7.80000000000000036e-52

    1. Initial program 77.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. fma-define77.7%

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

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

    if -7.80000000000000036e-52 < y.im < 9.59999999999999971e-20

    1. Initial program 64.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 83.2%

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

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

        \[\leadsto \frac{x.im}{y.re} + \color{blue}{\left(-\frac{x.re \cdot y.im}{{y.re}^{2}}\right)} \]
      3. unsub-neg83.2%

        \[\leadsto \color{blue}{\frac{x.im}{y.re} - \frac{x.re \cdot y.im}{{y.re}^{2}}} \]
      4. associate-/l*82.4%

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

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

    if 9.59999999999999971e-20 < y.im < 7.6000000000000005e75

    1. Initial program 99.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. Recombined 4 regimes into one program.
  4. Final simplification84.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.05 \cdot 10^{+65}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -7.8 \cdot 10^{-52}:\\ \;\;\;\;\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 9.6 \cdot 10^{-20}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}\\ \mathbf{elif}\;y.im \leq 7.6 \cdot 10^{+75}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 78.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\
t_1 := y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.05 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -2.0500000000000001e65 or 8.6000000000000002e75 < y.im

    1. Initial program 48.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 0 77.8%

      \[\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. +-commutative77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-neg77.8%

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]
      3. unsub-neg77.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. *-commutative77.8%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      5. associate-/l*82.0%

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

      \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity82.0%

        \[\leadsto y.re \cdot \frac{\color{blue}{1 \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      2. unpow282.0%

        \[\leadsto y.re \cdot \frac{1 \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      3. times-frac85.3%

        \[\leadsto y.re \cdot \color{blue}{\left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right)} - \frac{x.re}{y.im} \]
    7. Applied egg-rr85.3%

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

    if -2.0500000000000001e65 < y.im < -5.0000000000000001e-192 or 5.29999999999999989e-108 < y.im < 8.6000000000000002e75

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

    if -5.0000000000000001e-192 < y.im < 5.29999999999999989e-108

    1. Initial program 58.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 82.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2.05 \cdot 10^{+65}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -5 \cdot 10^{-192}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 5.3 \cdot 10^{-108}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.im \leq 8.6 \cdot 10^{+75}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 70.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -160 \lor \neg \left(y.im \leq 8.6\right):\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.im -160.0) (not (<= y.im 8.6)))
   (- (* y.re (* (/ 1.0 y.im) (/ x.im y.im))) (/ x.re y.im))
   (/ x.im y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -160.0) || !(y_46_im <= 8.6)) {
		tmp = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im);
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if ((y_46im <= (-160.0d0)) .or. (.not. (y_46im <= 8.6d0))) then
        tmp = (y_46re * ((1.0d0 / y_46im) * (x_46im / y_46im))) - (x_46re / y_46im)
    else
        tmp = x_46im / y_46re
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -160.0) || !(y_46_im <= 8.6)) {
		tmp = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im);
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (y_46_im <= -160.0) or not (y_46_im <= 8.6):
		tmp = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im)
	else:
		tmp = x_46_im / y_46_re
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((y_46_im <= -160.0) || !(y_46_im <= 8.6))
		tmp = Float64(Float64(y_46_re * Float64(Float64(1.0 / y_46_im) * Float64(x_46_im / y_46_im))) - Float64(x_46_re / y_46_im));
	else
		tmp = Float64(x_46_im / y_46_re);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_im <= -160.0) || ~((y_46_im <= 8.6)))
		tmp = (y_46_re * ((1.0 / y_46_im) * (x_46_im / y_46_im))) - (x_46_re / y_46_im);
	else
		tmp = x_46_im / y_46_re;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -160.0], N[Not[LessEqual[y$46$im, 8.6]], $MachinePrecision]], N[(N[(y$46$re * N[(N[(1.0 / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -160 \lor \neg \left(y.im \leq 8.6\right):\\
\;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -160 or 8.59999999999999964 < y.im

    1. Initial program 56.5%

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

      \[\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. +-commutative74.3%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} + -1 \cdot \frac{x.re}{y.im}} \]
      2. mul-1-neg74.3%

        \[\leadsto \frac{x.im \cdot y.re}{{y.im}^{2}} + \color{blue}{\left(-\frac{x.re}{y.im}\right)} \]
      3. unsub-neg74.3%

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      4. *-commutative74.3%

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{{y.im}^{2}} - \frac{x.re}{y.im} \]
      5. associate-/l*77.5%

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

      \[\leadsto \color{blue}{y.re \cdot \frac{x.im}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity77.5%

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

        \[\leadsto y.re \cdot \frac{1 \cdot x.im}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      3. times-frac80.0%

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

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

    if -160 < y.im < 8.59999999999999964

    1. Initial program 67.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -160 \lor \neg \left(y.im \leq 8.6\right):\\ \;\;\;\;y.re \cdot \left(\frac{1}{y.im} \cdot \frac{x.im}{y.im}\right) - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 64.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -7 \cdot 10^{+64} \lor \neg \left(y.im \leq 1050\right):\\ \;\;\;\;\frac{x.re}{-y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.im -7e+64) (not (<= y.im 1050.0)))
   (/ x.re (- y.im))
   (/ x.im y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -7e+64) || !(y_46_im <= 1050.0)) {
		tmp = x_46_re / -y_46_im;
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if ((y_46im <= (-7d+64)) .or. (.not. (y_46im <= 1050.0d0))) then
        tmp = x_46re / -y_46im
    else
        tmp = x_46im / y_46re
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_im <= -7e+64) || !(y_46_im <= 1050.0)) {
		tmp = x_46_re / -y_46_im;
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (y_46_im <= -7e+64) or not (y_46_im <= 1050.0):
		tmp = x_46_re / -y_46_im
	else:
		tmp = x_46_im / y_46_re
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((y_46_im <= -7e+64) || !(y_46_im <= 1050.0))
		tmp = Float64(x_46_re / Float64(-y_46_im));
	else
		tmp = Float64(x_46_im / y_46_re);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_im <= -7e+64) || ~((y_46_im <= 1050.0)))
		tmp = x_46_re / -y_46_im;
	else
		tmp = x_46_im / y_46_re;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -7e+64], N[Not[LessEqual[y$46$im, 1050.0]], $MachinePrecision]], N[(x$46$re / (-y$46$im)), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7 \cdot 10^{+64} \lor \neg \left(y.im \leq 1050\right):\\
\;\;\;\;\frac{x.re}{-y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -6.9999999999999997e64 or 1050 < 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 73.2%

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x.re}{y.im}} \]
      2. neg-mul-173.2%

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

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

    if -6.9999999999999997e64 < y.im < 1050

    1. Initial program 68.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -7 \cdot 10^{+64} \lor \neg \left(y.im \leq 1050\right):\\ \;\;\;\;\frac{x.re}{-y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 43.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq 1.25 \cdot 10^{+242}:\\
\;\;\;\;\frac{x.im}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < 1.2500000000000001e242

    1. Initial program 62.2%

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

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

    if 1.2500000000000001e242 < y.im

    1. Initial program 58.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. fma-define58.3%

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. add-sqr-sqrt59.9%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      3. hypot-undefine59.9%

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
      4. hypot-undefine59.9%

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

        \[\leadsto \color{blue}{\frac{y.re}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}} \]
      6. hypot-undefine59.9%

        \[\leadsto \frac{y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      7. +-commutative59.9%

        \[\leadsto \frac{y.re}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
      8. hypot-define59.9%

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

        \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      10. +-commutative59.9%

        \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \]
      11. hypot-define59.9%

        \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.im, y.re\right)}} \]
    9. Applied egg-rr59.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq 1.25 \cdot 10^{+242}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 9.5% accurate, 5.0× speedup?

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

\\
\frac{x.im}{y.im}
\end{array}
Derivation
  1. Initial program 62.0%

    \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
  2. Step-by-step derivation
    1. fma-define62.0%

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

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

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

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

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

      \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
    2. add-sqr-sqrt42.7%

      \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
    3. hypot-undefine42.7%

      \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}} \]
    4. hypot-undefine42.7%

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

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

      \[\leadsto \frac{y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
    7. +-commutative47.4%

      \[\leadsto \frac{y.re}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
    8. hypot-define61.9%

      \[\leadsto \frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot \frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \]
    9. hypot-undefine47.4%

      \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
    10. +-commutative47.4%

      \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\sqrt{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}}} \]
    11. hypot-define61.9%

      \[\leadsto \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.im}{\color{blue}{\mathsf{hypot}\left(y.im, y.re\right)}} \]
  9. Applied egg-rr61.9%

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

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

    \[\leadsto \color{blue}{\frac{x.im}{y.im}} \]
  12. Final simplification11.7%

    \[\leadsto \frac{x.im}{y.im} \]
  13. Add Preprocessing

Reproduce

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