_divideComplex, imaginary part

Percentage Accurate: 60.9% → 98.0%
Time: 16.1s
Alternatives: 15
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 15 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: 60.9% 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.0% 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{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \left(-x.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))
  (/ (* (/ y.im (hypot y.im y.re)) (- x.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)), (((y_46_im / hypot(y_46_im, y_46_re)) * -x_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(Float64(y_46_im / hypot(y_46_im, y_46_re)) * Float64(-x_46_re)) / 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[(N[(y$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * (-x$46$re)), $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{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \left(-x.re\right)}{\mathsf{hypot}\left(y.im, y.re\right)}\right)
\end{array}
Derivation
  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-sub61.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. *-commutative61.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. add-sqr-sqrt61.0%

      \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    4. times-frac62.1%

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
    7. hypot-define76.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) \]
    8. associate-/l*79.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) \]
    9. add-sqr-sqrt79.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
    10. pow279.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
    11. hypot-define79.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
  4. Applied egg-rr79.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-identity79.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. unpow279.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.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. add-sqr-sqrt47.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(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    5. sqrt-prod59.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    6. sqr-neg59.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    7. sqrt-unprod31.1%

      \[\leadsto \mathsf{fma}\left(\frac{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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    8. add-sqr-sqrt58.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(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    9. hypot-undefine56.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 \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) \]
    10. +-commutative56.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 \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) \]
    11. hypot-define58.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(\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) \]
    12. add-sqr-sqrt31.1%

      \[\leadsto \mathsf{fma}\left(\frac{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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    13. sqrt-unprod59.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    14. sqr-neg59.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    15. sqrt-prod47.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(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    16. add-sqr-sqrt97.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
    17. hypot-undefine79.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) \]
    18. +-commutative79.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) \]
    19. 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. Step-by-step derivation
    1. *-commutative97.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
    2. associate-*l/97.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{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
    3. *-un-lft-identity97.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{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
    4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
  8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
  9. Final simplification99.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)}, \frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \left(-x.re\right)}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \]
  10. Add Preprocessing

Alternative 2: 80.2% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ t_1 := y.re \cdot y.re + y.im \cdot y.im\\ t_2 := \mathsf{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}{-y.im}\right)\\ \mathbf{if}\;y.re \leq -3.8 \cdot 10^{+133}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-131}:\\ \;\;\;\;\frac{y.re \cdot x.im + \mathsf{fma}\left(x.re, -y.im, \mathsf{fma}\left(x.re, -y.im, y.im \cdot x.re\right)\right)}{t\_1}\\ \mathbf{elif}\;y.re \leq 8.2 \cdot 10^{-29}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y.re \leq 1.3 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{t\_1}\\ \mathbf{elif}\;y.re \leq 1.36 \cdot 10^{+79}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (* y.re (/ x.im (hypot y.im y.re))) (hypot y.im y.re)))
        (t_1 (+ (* y.re y.re) (* y.im y.im)))
        (t_2
         (fma
          (/ y.re (hypot y.re y.im))
          (/ x.im (hypot y.re y.im))
          (/ x.re (- y.im)))))
   (if (<= y.re -3.8e+133)
     t_0
     (if (<= y.re -1.9e-131)
       (/
        (+ (* y.re x.im) (fma x.re (- y.im) (fma x.re (- y.im) (* y.im x.re))))
        t_1)
       (if (<= y.re 8.2e-29)
         t_2
         (if (<= y.re 1.3e+44)
           (/ (fma (- y.im) x.re (* y.re x.im)) t_1)
           (if (<= y.re 1.36e+79) t_2 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 * (x_46_im / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re);
	double t_1 = (y_46_re * y_46_re) + (y_46_im * y_46_im);
	double t_2 = 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));
	double tmp;
	if (y_46_re <= -3.8e+133) {
		tmp = t_0;
	} else if (y_46_re <= -1.9e-131) {
		tmp = ((y_46_re * x_46_im) + fma(x_46_re, -y_46_im, fma(x_46_re, -y_46_im, (y_46_im * x_46_re)))) / t_1;
	} else if (y_46_re <= 8.2e-29) {
		tmp = t_2;
	} else if (y_46_re <= 1.3e+44) {
		tmp = fma(-y_46_im, x_46_re, (y_46_re * x_46_im)) / t_1;
	} else if (y_46_re <= 1.36e+79) {
		tmp = t_2;
	} 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(x_46_im / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re))
	t_1 = Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))
	t_2 = 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(-y_46_im)))
	tmp = 0.0
	if (y_46_re <= -3.8e+133)
		tmp = t_0;
	elseif (y_46_re <= -1.9e-131)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) + fma(x_46_re, Float64(-y_46_im), fma(x_46_re, Float64(-y_46_im), Float64(y_46_im * x_46_re)))) / t_1);
	elseif (y_46_re <= 8.2e-29)
		tmp = t_2;
	elseif (y_46_re <= 1.3e+44)
		tmp = Float64(fma(Float64(-y_46_im), x_46_re, Float64(y_46_re * x_46_im)) / t_1);
	elseif (y_46_re <= 1.36e+79)
		tmp = t_2;
	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[(x$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]}, Block[{t$95$1 = N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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 / (-y$46$im)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -3.8e+133], t$95$0, If[LessEqual[y$46$re, -1.9e-131], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * (-y$46$im) + N[(x$46$re * (-y$46$im) + N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 8.2e-29], t$95$2, If[LessEqual[y$46$re, 1.3e+44], N[(N[((-y$46$im) * x$46$re + N[(y$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 1.36e+79], t$95$2, t$95$0]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\
t_1 := y.re \cdot y.re + y.im \cdot y.im\\
t_2 := \mathsf{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}{-y.im}\right)\\
\mathbf{if}\;y.re \leq -3.8 \cdot 10^{+133}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-131}:\\
\;\;\;\;\frac{y.re \cdot x.im + \mathsf{fma}\left(x.re, -y.im, \mathsf{fma}\left(x.re, -y.im, y.im \cdot x.re\right)\right)}{t\_1}\\

\mathbf{elif}\;y.re \leq 8.2 \cdot 10^{-29}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y.re \leq 1.3 \cdot 10^{+44}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{t\_1}\\

\mathbf{elif}\;y.re \leq 1.36 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -3.8000000000000002e133 or 1.36000000000000003e79 < y.re

    1. Initial program 34.7%

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

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

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

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{{y.re}^{2} + {y.im}^{2}}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      3. unpow235.1%

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{y.re \cdot y.re} + {y.im}^{2}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      4. unpow235.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto y.re \cdot \frac{x.im}{{\color{blue}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^{2}} \]
      14. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.re}^{2}} + y.im \cdot y.im}\right)}^{2}} \]
      15. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{{y.re}^{2} + \color{blue}{{y.im}^{2}}}\right)}^{2}} \]
      16. +-commutative36.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.im}^{2} + {y.re}^{2}}}\right)}^{2}} \]
      17. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{y.im \cdot y.im} + {y.re}^{2}}\right)}^{2}} \]
      18. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}}\right)}^{2}} \]
      19. hypot-define36.1%

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \color{blue}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}} \]
      6. unpow235.1%

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \sqrt{\color{blue}{{y.im}^{2}} + y.re \cdot y.re}} \]
      7. add-sqr-sqrt35.1%

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + {y.im}^{2}}} \]
      9. unpow235.1%

        \[\leadsto \frac{y.re \cdot x.im}{y.re \cdot y.re + \color{blue}{y.im \cdot y.im}} \]
      10. rem-square-sqrt35.1%

        \[\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}}} \]
      11. hypot-undefine35.1%

        \[\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}} \]
      12. hypot-undefine35.1%

        \[\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)}} \]
      13. frac-times79.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)}} \]
      14. associate-*l/79.9%

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

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

    if -3.8000000000000002e133 < y.re < -1.89999999999999997e-131

    1. Initial program 90.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. prod-diff90.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im \cdot y.re + \mathsf{fma}\left(x.re, -y.im, \left(-\color{blue}{x.re \cdot y.im}\right) + x.re \cdot y.im\right)}{y.re \cdot y.re + y.im \cdot y.im} \]
      11. distribute-rgt-neg-in90.6%

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

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

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

    if -1.89999999999999997e-131 < y.re < 8.1999999999999996e-29 or 1.3e44 < y.re < 1.36000000000000003e79

    1. Initial program 66.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-sub61.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. *-commutative61.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. add-sqr-sqrt61.3%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac62.3%

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

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

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

        \[\leadsto \mathsf{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) \]
      9. add-sqr-sqrt70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow270.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr70.1%

      \[\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 95.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}{\frac{x.re}{y.im}}\right) \]

    if 8.1999999999999996e-29 < y.re < 1.3e44

    1. Initial program 89.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. sub-neg89.5%

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

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

        \[\leadsto \frac{\left(-\color{blue}{y.im \cdot x.re}\right) + x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. distribute-lft-neg-in89.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -3.8 \cdot 10^{+133}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-131}:\\ \;\;\;\;\frac{y.re \cdot x.im + \mathsf{fma}\left(x.re, -y.im, \mathsf{fma}\left(x.re, -y.im, y.im \cdot x.re\right)\right)}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 8.2 \cdot 10^{-29}:\\ \;\;\;\;\mathsf{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}{-y.im}\right)\\ \mathbf{elif}\;y.re \leq 1.3 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 1.36 \cdot 10^{+79}:\\ \;\;\;\;\mathsf{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}{-y.im}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 88.8% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im} \leq 2 \cdot 10^{+281}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right)}{\mathsf{hypot}\left(y.re, y.im\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)}, \frac{x.re}{-y.im}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<=
      (/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
      2e+281)
   (*
    (/ 1.0 (hypot y.re y.im))
    (/ (fma x.im y.re (* x.re (- y.im))) (hypot y.re y.im)))
   (fma
    (/ y.re (hypot y.re y.im))
    (/ x.im (hypot y.re y.im))
    (/ x.re (- y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 2e+281) {
		tmp = (1.0 / hypot(y_46_re, y_46_im)) * (fma(x_46_im, y_46_re, (x_46_re * -y_46_im)) / hypot(y_46_re, y_46_im));
	} else {
		tmp = 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));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (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))) <= 2e+281)
		tmp = Float64(Float64(1.0 / hypot(y_46_re, y_46_im)) * Float64(fma(x_46_im, y_46_re, Float64(x_46_re * Float64(-y_46_im))) / hypot(y_46_re, y_46_im)));
	else
		tmp = 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(-y_46_im)));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[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], 2e+281], N[(N[(1.0 / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(x$46$im * y$46$re + N[(x$46$re * (-y$46$im)), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$46$re ^ 2 + y$46$im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 / (-y$46$im)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im} \leq 2 \cdot 10^{+281}:\\
\;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right)}{\mathsf{hypot}\left(y.re, y.im\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)}, \frac{x.re}{-y.im}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 2.0000000000000001e281

    1. Initial program 78.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. *-un-lft-identity78.0%

        \[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. add-sqr-sqrt78.0%

        \[\leadsto \frac{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}{\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. times-frac78.1%

        \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} \]
      4. hypot-define78.1%

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

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

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

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

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

    if 2.0000000000000001e281 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im)))

    1. Initial program 15.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-sub10.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. *-commutative10.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. add-sqr-sqrt10.0%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac11.2%

        \[\leadsto \color{blue}{\frac{y.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im}{\sqrt{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} \]
      5. fma-neg11.2%

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
      7. hypot-define44.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) \]
      8. associate-/l*54.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) \]
      9. add-sqr-sqrt54.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow254.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define54.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr54.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. Taylor expanded in y.im around inf 73.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}{\frac{x.re}{y.im}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im} \leq 2 \cdot 10^{+281}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\mathsf{fma}\left(x.im, y.re, x.re \cdot \left(-y.im\right)\right)}{\mathsf{hypot}\left(y.re, y.im\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)}, \frac{x.re}{-y.im}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y.re \cdot y.re + y.im \cdot y.im\\ t_1 := \frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ t_2 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{if}\;y.re \leq -4.2 \cdot 10^{+134}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq -1.05 \cdot 10^{-139}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{t\_0}\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{-29}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{t\_0}\\ \mathbf{elif}\;y.re \leq 1.25 \cdot 10^{+79}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (+ (* y.re y.re) (* y.im y.im)))
        (t_1 (/ (* y.re (/ x.im (hypot y.im y.re))) (hypot y.im y.re)))
        (t_2 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
   (if (<= y.re -4.2e+134)
     t_1
     (if (<= y.re -1.05e-139)
       (/ (- (* y.re x.im) (* y.im x.re)) t_0)
       (if (<= y.re 2e-29)
         t_2
         (if (<= y.re 1.6e+44)
           (/ (fma (- y.im) x.re (* y.re x.im)) t_0)
           (if (<= y.re 1.25e+79) t_2 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 * y_46_re) + (y_46_im * y_46_im);
	double t_1 = (y_46_re * (x_46_im / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re);
	double t_2 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -4.2e+134) {
		tmp = t_1;
	} else if (y_46_re <= -1.05e-139) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / t_0;
	} else if (y_46_re <= 2e-29) {
		tmp = t_2;
	} else if (y_46_re <= 1.6e+44) {
		tmp = fma(-y_46_im, x_46_re, (y_46_re * x_46_im)) / t_0;
	} else if (y_46_re <= 1.25e+79) {
		tmp = t_2;
	} 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 * y_46_re) + Float64(y_46_im * y_46_im))
	t_1 = Float64(Float64(y_46_re * Float64(x_46_im / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re))
	t_2 = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_re <= -4.2e+134)
		tmp = t_1;
	elseif (y_46_re <= -1.05e-139)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / t_0);
	elseif (y_46_re <= 2e-29)
		tmp = t_2;
	elseif (y_46_re <= 1.6e+44)
		tmp = Float64(fma(Float64(-y_46_im), x_46_re, Float64(y_46_re * x_46_im)) / t_0);
	elseif (y_46_re <= 1.25e+79)
		tmp = t_2;
	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 * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y$46$re * N[(x$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]}, Block[{t$95$2 = N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$re, -4.2e+134], t$95$1, If[LessEqual[y$46$re, -1.05e-139], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 2e-29], t$95$2, If[LessEqual[y$46$re, 1.6e+44], N[(N[((-y$46$im) * x$46$re + N[(y$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.25e+79], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq -1.05 \cdot 10^{-139}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{t\_0}\\

\mathbf{elif}\;y.re \leq 2 \cdot 10^{-29}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;y.re \leq 1.25 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -4.2000000000000002e134 or 1.25e79 < y.re

    1. Initial program 34.7%

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

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

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

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{{y.re}^{2} + {y.im}^{2}}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      3. unpow235.1%

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{y.re \cdot y.re} + {y.im}^{2}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      4. unpow235.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto y.re \cdot \frac{x.im}{{\color{blue}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^{2}} \]
      14. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.re}^{2}} + y.im \cdot y.im}\right)}^{2}} \]
      15. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{{y.re}^{2} + \color{blue}{{y.im}^{2}}}\right)}^{2}} \]
      16. +-commutative36.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.im}^{2} + {y.re}^{2}}}\right)}^{2}} \]
      17. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{y.im \cdot y.im} + {y.re}^{2}}\right)}^{2}} \]
      18. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}}\right)}^{2}} \]
      19. hypot-define36.1%

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \color{blue}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}} \]
      6. unpow235.1%

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \sqrt{\color{blue}{{y.im}^{2}} + y.re \cdot y.re}} \]
      7. add-sqr-sqrt35.1%

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + {y.im}^{2}}} \]
      9. unpow235.1%

        \[\leadsto \frac{y.re \cdot x.im}{y.re \cdot y.re + \color{blue}{y.im \cdot y.im}} \]
      10. rem-square-sqrt35.1%

        \[\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}}} \]
      11. hypot-undefine35.1%

        \[\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}} \]
      12. hypot-undefine35.1%

        \[\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)}} \]
      13. frac-times79.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)}} \]
      14. associate-*l/79.9%

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

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

    if -4.2000000000000002e134 < y.re < -1.05000000000000004e-139

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

    if -1.05000000000000004e-139 < y.re < 1.99999999999999989e-29 or 1.60000000000000002e44 < y.re < 1.25e79

    1. Initial program 66.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-sub61.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. *-commutative61.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. add-sqr-sqrt61.3%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac62.3%

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

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

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

        \[\leadsto \mathsf{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) \]
      9. add-sqr-sqrt70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow270.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr70.1%

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

        \[\leadsto \mathsf{fma}\left(\frac{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. unpow270.1%

        \[\leadsto \mathsf{fma}\left(\frac{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-frac99.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. add-sqr-sqrt49.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod48.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg48.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod19.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt37.1%

        \[\leadsto \mathsf{fma}\left(\frac{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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine31.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) \]
      10. +-commutative31.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) \]
      11. hypot-define37.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      12. add-sqr-sqrt19.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod48.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg48.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod49.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      18. +-commutative70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/100.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr100.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 83.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-183.3%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/83.9%

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

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

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

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

        \[\leadsto x.im \cdot \frac{1 \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      7. times-frac90.2%

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/90.2%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity90.2%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*91.0%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub92.1%

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

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

    if 1.99999999999999989e-29 < y.re < 1.60000000000000002e44

    1. Initial program 89.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. sub-neg89.5%

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

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

        \[\leadsto \frac{\left(-\color{blue}{y.im \cdot x.re}\right) + x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. distribute-lft-neg-in89.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -4.2 \cdot 10^{+134}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \mathbf{elif}\;y.re \leq -1.05 \cdot 10^{-139}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{-29}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 1.25 \cdot 10^{+79}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ t_1 := y.re \cdot y.re + y.im \cdot y.im\\ t_2 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{if}\;y.re \leq -9.2 \cdot 10^{+133}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-136}:\\ \;\;\;\;\frac{y.re \cdot x.im + \mathsf{fma}\left(x.re, -y.im, \mathsf{fma}\left(x.re, -y.im, y.im \cdot x.re\right)\right)}{t\_1}\\ \mathbf{elif}\;y.re \leq 1.2 \cdot 10^{-28}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{t\_1}\\ \mathbf{elif}\;y.re \leq 1.7 \cdot 10^{+79}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (* y.re (/ x.im (hypot y.im y.re))) (hypot y.im y.re)))
        (t_1 (+ (* y.re y.re) (* y.im y.im)))
        (t_2 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
   (if (<= y.re -9.2e+133)
     t_0
     (if (<= y.re -1.9e-136)
       (/
        (+ (* y.re x.im) (fma x.re (- y.im) (fma x.re (- y.im) (* y.im x.re))))
        t_1)
       (if (<= y.re 1.2e-28)
         t_2
         (if (<= y.re 1.6e+44)
           (/ (fma (- y.im) x.re (* y.re x.im)) t_1)
           (if (<= y.re 1.7e+79) t_2 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 * (x_46_im / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re);
	double t_1 = (y_46_re * y_46_re) + (y_46_im * y_46_im);
	double t_2 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -9.2e+133) {
		tmp = t_0;
	} else if (y_46_re <= -1.9e-136) {
		tmp = ((y_46_re * x_46_im) + fma(x_46_re, -y_46_im, fma(x_46_re, -y_46_im, (y_46_im * x_46_re)))) / t_1;
	} else if (y_46_re <= 1.2e-28) {
		tmp = t_2;
	} else if (y_46_re <= 1.6e+44) {
		tmp = fma(-y_46_im, x_46_re, (y_46_re * x_46_im)) / t_1;
	} else if (y_46_re <= 1.7e+79) {
		tmp = t_2;
	} 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(x_46_im / hypot(y_46_im, y_46_re))) / hypot(y_46_im, y_46_re))
	t_1 = Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))
	t_2 = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_re <= -9.2e+133)
		tmp = t_0;
	elseif (y_46_re <= -1.9e-136)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) + fma(x_46_re, Float64(-y_46_im), fma(x_46_re, Float64(-y_46_im), Float64(y_46_im * x_46_re)))) / t_1);
	elseif (y_46_re <= 1.2e-28)
		tmp = t_2;
	elseif (y_46_re <= 1.6e+44)
		tmp = Float64(fma(Float64(-y_46_im), x_46_re, Float64(y_46_re * x_46_im)) / t_1);
	elseif (y_46_re <= 1.7e+79)
		tmp = t_2;
	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[(x$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]}, Block[{t$95$1 = N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$re, -9.2e+133], t$95$0, If[LessEqual[y$46$re, -1.9e-136], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] + N[(x$46$re * (-y$46$im) + N[(x$46$re * (-y$46$im) + N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 1.2e-28], t$95$2, If[LessEqual[y$46$re, 1.6e+44], N[(N[((-y$46$im) * x$46$re + N[(y$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 1.7e+79], t$95$2, t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-136}:\\
\;\;\;\;\frac{y.re \cdot x.im + \mathsf{fma}\left(x.re, -y.im, \mathsf{fma}\left(x.re, -y.im, y.im \cdot x.re\right)\right)}{t\_1}\\

\mathbf{elif}\;y.re \leq 1.2 \cdot 10^{-28}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+44}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{t\_1}\\

\mathbf{elif}\;y.re \leq 1.7 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -9.1999999999999996e133 or 1.70000000000000016e79 < y.re

    1. Initial program 34.7%

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

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

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

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{{y.re}^{2} + {y.im}^{2}}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      3. unpow235.1%

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{y.re \cdot y.re} + {y.im}^{2}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      4. unpow235.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto y.re \cdot \frac{x.im}{{\color{blue}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^{2}} \]
      14. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.re}^{2}} + y.im \cdot y.im}\right)}^{2}} \]
      15. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{{y.re}^{2} + \color{blue}{{y.im}^{2}}}\right)}^{2}} \]
      16. +-commutative36.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.im}^{2} + {y.re}^{2}}}\right)}^{2}} \]
      17. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{y.im \cdot y.im} + {y.re}^{2}}\right)}^{2}} \]
      18. unpow236.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}}\right)}^{2}} \]
      19. hypot-define36.1%

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \color{blue}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}} \]
      6. unpow235.1%

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \sqrt{\color{blue}{{y.im}^{2}} + y.re \cdot y.re}} \]
      7. add-sqr-sqrt35.1%

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + {y.im}^{2}}} \]
      9. unpow235.1%

        \[\leadsto \frac{y.re \cdot x.im}{y.re \cdot y.re + \color{blue}{y.im \cdot y.im}} \]
      10. rem-square-sqrt35.1%

        \[\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}}} \]
      11. hypot-undefine35.1%

        \[\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}} \]
      12. hypot-undefine35.1%

        \[\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)}} \]
      13. frac-times79.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)}} \]
      14. associate-*l/79.9%

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

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

    if -9.1999999999999996e133 < y.re < -1.9000000000000001e-136

    1. Initial program 90.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. prod-diff90.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x.im \cdot y.re + \mathsf{fma}\left(x.re, -y.im, \left(-\color{blue}{x.re \cdot y.im}\right) + x.re \cdot y.im\right)}{y.re \cdot y.re + y.im \cdot y.im} \]
      11. distribute-rgt-neg-in90.6%

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

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

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

    if -1.9000000000000001e-136 < y.re < 1.2000000000000001e-28 or 1.60000000000000002e44 < y.re < 1.70000000000000016e79

    1. Initial program 66.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-sub61.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. *-commutative61.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. add-sqr-sqrt61.3%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac62.3%

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

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

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

        \[\leadsto \mathsf{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) \]
      9. add-sqr-sqrt70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow270.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr70.1%

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

        \[\leadsto \mathsf{fma}\left(\frac{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. unpow270.1%

        \[\leadsto \mathsf{fma}\left(\frac{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-frac99.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. add-sqr-sqrt49.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod48.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg48.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod19.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt37.1%

        \[\leadsto \mathsf{fma}\left(\frac{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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine31.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) \]
      10. +-commutative31.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) \]
      11. hypot-define37.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      12. add-sqr-sqrt19.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod48.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg48.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod49.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      18. +-commutative70.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/100.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr100.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 83.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-183.3%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/83.9%

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

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

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

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

        \[\leadsto x.im \cdot \frac{1 \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      7. times-frac90.2%

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/90.2%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity90.2%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*91.0%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub92.1%

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

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

    if 1.2000000000000001e-28 < y.re < 1.60000000000000002e44

    1. Initial program 89.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. sub-neg89.5%

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

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

        \[\leadsto \frac{\left(-\color{blue}{y.im \cdot x.re}\right) + x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. distribute-lft-neg-in89.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -9.2 \cdot 10^{+133}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \mathbf{elif}\;y.re \leq -1.9 \cdot 10^{-136}:\\ \;\;\;\;\frac{y.re \cdot x.im + \mathsf{fma}\left(x.re, -y.im, \mathsf{fma}\left(x.re, -y.im, y.im \cdot x.re\right)\right)}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 1.2 \cdot 10^{-28}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 1.7 \cdot 10^{+79}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re \cdot \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 79.2% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := y.re \cdot y.re + y.im \cdot y.im\\
\mathbf{if}\;y.re \leq -2.12 \cdot 10^{+133}:\\
\;\;\;\;\frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\

\mathbf{elif}\;y.re \leq -6 \cdot 10^{-131}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{t\_0}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -2.12e133

    1. Initial program 30.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 74.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. +-commutative74.5%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x.im}{y.re} - x.re \cdot \frac{y.im}{{y.re}^{2}}} \]
    6. Step-by-step derivation
      1. div-inv77.3%

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

        \[\leadsto \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot \color{blue}{{y.re}^{\left(-2\right)}}\right) \]
      3. metadata-eval79.1%

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

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

    if -2.12e133 < y.re < -5.99999999999999992e-131

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

    if -5.99999999999999992e-131 < y.re < 1.99999999999999989e-29

    1. Initial program 69.7%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub64.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. *-commutative64.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. add-sqr-sqrt64.0%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac65.1%

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

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

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

        \[\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) \]
      8. associate-/l*71.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) \]
      9. add-sqr-sqrt71.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow271.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define71.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr71.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. Step-by-step derivation
      1. *-un-lft-identity71.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{\color{blue}{1 \cdot y.im}}{{\left(\mathsf{hypot}\left(y.re, y.im\right)\right)}^{2}}\right) \]
      2. unpow271.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{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-frac99.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. add-sqr-sqrt49.1%

        \[\leadsto \mathsf{fma}\left(\frac{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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod51.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg51.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod19.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt35.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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine29.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) \]
      10. +-commutative29.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) \]
      11. hypot-define35.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) \]
      12. add-sqr-sqrt19.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod51.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg51.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod49.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine71.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) \]
      18. +-commutative71.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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/100.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr100.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 86.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-186.8%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/87.3%

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

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

        \[\leadsto \color{blue}{x.im \cdot \frac{y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      5. *-lft-identity87.3%

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/92.2%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity92.2%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*92.2%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub93.3%

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

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

    if 1.99999999999999989e-29 < y.re < 2.50000000000000002e40

    1. Initial program 89.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. sub-neg89.0%

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re + \left(-x.re \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. +-commutative89.0%

        \[\leadsto \frac{\color{blue}{\left(-x.re \cdot y.im\right) + x.im \cdot y.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. *-commutative89.0%

        \[\leadsto \frac{\left(-\color{blue}{y.im \cdot x.re}\right) + x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. distribute-lft-neg-in89.0%

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

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

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

    if 2.50000000000000002e40 < y.re

    1. Initial program 39.1%

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

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

        \[\leadsto \frac{x.im \cdot y.re}{\color{blue}{\sqrt{{y.im}^{2} + {y.re}^{2}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}}} \]
      2. +-commutative39.7%

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{{y.re}^{2} + {y.im}^{2}}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      3. unpow239.7%

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{y.re \cdot y.re} + {y.im}^{2}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      4. unpow239.7%

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{y.re \cdot y.re + \color{blue}{y.im \cdot y.im}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      5. hypot-undefine39.7%

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

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

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

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

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

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

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

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

        \[\leadsto y.re \cdot \frac{x.im}{{\color{blue}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^{2}} \]
      14. unpow240.7%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.re}^{2}} + y.im \cdot y.im}\right)}^{2}} \]
      15. unpow240.7%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{{y.re}^{2} + \color{blue}{{y.im}^{2}}}\right)}^{2}} \]
      16. +-commutative40.7%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.im}^{2} + {y.re}^{2}}}\right)}^{2}} \]
      17. unpow240.7%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{y.im \cdot y.im} + {y.re}^{2}}\right)}^{2}} \]
      18. unpow240.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \color{blue}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}} \]
      6. unpow239.7%

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \sqrt{\color{blue}{{y.im}^{2}} + y.re \cdot y.re}} \]
      7. add-sqr-sqrt39.7%

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + {y.im}^{2}}} \]
      9. unpow239.7%

        \[\leadsto \frac{y.re \cdot x.im}{y.re \cdot y.re + \color{blue}{y.im \cdot y.im}} \]
      10. rem-square-sqrt39.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}}} \]
      11. hypot-undefine39.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}} \]
      12. hypot-undefine39.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)}} \]
      13. frac-times76.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)}} \]
      14. clear-num76.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.12 \cdot 10^{+133}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\ \mathbf{elif}\;y.re \leq -6 \cdot 10^{-131}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{-29}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 2.5 \cdot 10^{+40}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right) \cdot \frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.re}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 78.1% 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 := \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\ t_2 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{if}\;y.re \leq -2.12 \cdot 10^{+133}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq -5.5 \cdot 10^{-129}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 2.4 \cdot 10^{-29}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 10^{+88}:\\ \;\;\;\;t\_2\\ \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 (- (/ x.im y.re) (* x.re (* y.im (pow y.re -2.0)))))
        (t_2 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
   (if (<= y.re -2.12e+133)
     t_1
     (if (<= y.re -5.5e-129)
       t_0
       (if (<= y.re 2.4e-29)
         t_2
         (if (<= y.re 1.75e+44) t_0 (if (<= y.re 1e+88) t_2 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 = (x_46_im / y_46_re) - (x_46_re * (y_46_im * pow(y_46_re, -2.0)));
	double t_2 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -2.12e+133) {
		tmp = t_1;
	} else if (y_46_re <= -5.5e-129) {
		tmp = t_0;
	} else if (y_46_re <= 2.4e-29) {
		tmp = t_2;
	} else if (y_46_re <= 1.75e+44) {
		tmp = t_0;
	} else if (y_46_re <= 1e+88) {
		tmp = t_2;
	} 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) :: t_2
    real(8) :: tmp
    t_0 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
    t_1 = (x_46im / y_46re) - (x_46re * (y_46im * (y_46re ** (-2.0d0))))
    t_2 = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
    if (y_46re <= (-2.12d+133)) then
        tmp = t_1
    else if (y_46re <= (-5.5d-129)) then
        tmp = t_0
    else if (y_46re <= 2.4d-29) then
        tmp = t_2
    else if (y_46re <= 1.75d+44) then
        tmp = t_0
    else if (y_46re <= 1d+88) then
        tmp = t_2
    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 = (x_46_im / y_46_re) - (x_46_re * (y_46_im * Math.pow(y_46_re, -2.0)));
	double t_2 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -2.12e+133) {
		tmp = t_1;
	} else if (y_46_re <= -5.5e-129) {
		tmp = t_0;
	} else if (y_46_re <= 2.4e-29) {
		tmp = t_2;
	} else if (y_46_re <= 1.75e+44) {
		tmp = t_0;
	} else if (y_46_re <= 1e+88) {
		tmp = t_2;
	} 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 = (x_46_im / y_46_re) - (x_46_re * (y_46_im * math.pow(y_46_re, -2.0)))
	t_2 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	tmp = 0
	if y_46_re <= -2.12e+133:
		tmp = t_1
	elif y_46_re <= -5.5e-129:
		tmp = t_0
	elif y_46_re <= 2.4e-29:
		tmp = t_2
	elif y_46_re <= 1.75e+44:
		tmp = t_0
	elif y_46_re <= 1e+88:
		tmp = t_2
	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(x_46_im / y_46_re) - Float64(x_46_re * Float64(y_46_im * (y_46_re ^ -2.0))))
	t_2 = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_re <= -2.12e+133)
		tmp = t_1;
	elseif (y_46_re <= -5.5e-129)
		tmp = t_0;
	elseif (y_46_re <= 2.4e-29)
		tmp = t_2;
	elseif (y_46_re <= 1.75e+44)
		tmp = t_0;
	elseif (y_46_re <= 1e+88)
		tmp = t_2;
	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 = (x_46_im / y_46_re) - (x_46_re * (y_46_im * (y_46_re ^ -2.0)));
	t_2 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	tmp = 0.0;
	if (y_46_re <= -2.12e+133)
		tmp = t_1;
	elseif (y_46_re <= -5.5e-129)
		tmp = t_0;
	elseif (y_46_re <= 2.4e-29)
		tmp = t_2;
	elseif (y_46_re <= 1.75e+44)
		tmp = t_0;
	elseif (y_46_re <= 1e+88)
		tmp = t_2;
	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[(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$2 = N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$re, -2.12e+133], t$95$1, If[LessEqual[y$46$re, -5.5e-129], t$95$0, If[LessEqual[y$46$re, 2.4e-29], t$95$2, If[LessEqual[y$46$re, 1.75e+44], t$95$0, If[LessEqual[y$46$re, 1e+88], t$95$2, 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 := \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\
t_2 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
\mathbf{if}\;y.re \leq -2.12 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y.re \leq -5.5 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 2.4 \cdot 10^{-29}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 10^{+88}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -2.12e133 or 9.99999999999999959e87 < y.re

    1. Initial program 34.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 73.6%

      \[\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. +-commutative73.6%

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - x.re \cdot \color{blue}{\left(y.im \cdot \frac{1}{{y.re}^{2}}\right)} \]
      2. pow-flip78.9%

        \[\leadsto \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot \color{blue}{{y.re}^{\left(-2\right)}}\right) \]
      3. metadata-eval78.9%

        \[\leadsto \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{\color{blue}{-2}}\right) \]
    7. Applied egg-rr78.9%

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

    if -2.12e133 < y.re < -5.50000000000000023e-129 or 2.39999999999999992e-29 < y.re < 1.75e44

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

    if -5.50000000000000023e-129 < y.re < 2.39999999999999992e-29 or 1.75e44 < y.re < 9.99999999999999959e87

    1. Initial program 65.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-sub60.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. *-commutative60.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. add-sqr-sqrt60.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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac61.9%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
      7. hypot-define64.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) \]
      8. associate-/l*70.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) \]
      9. add-sqr-sqrt70.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow270.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define70.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr70.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-identity70.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. unpow270.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-frac99.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. add-sqr-sqrt48.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod47.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg47.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod21.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt38.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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine33.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) \]
      10. +-commutative33.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) \]
      11. hypot-define38.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) \]
      12. add-sqr-sqrt21.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod47.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg47.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod48.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine70.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) \]
      18. +-commutative70.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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 82.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-182.1%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/82.7%

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

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

        \[\leadsto \color{blue}{x.im \cdot \frac{y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      5. *-lft-identity82.7%

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/88.7%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity88.7%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*90.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub91.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.12 \cdot 10^{+133}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\ \mathbf{elif}\;y.re \leq -5.5 \cdot 10^{-129}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 2.4 \cdot 10^{-29}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 10^{+88}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 78.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ t_1 := \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\ t_2 := y.re \cdot y.re + y.im \cdot y.im\\ \mathbf{if}\;y.re \leq -2.2 \cdot 10^{+135}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq -1.1 \cdot 10^{-136}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{t\_2}\\ \mathbf{elif}\;y.re \leq 3.3 \cdot 10^{-29}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{t\_2}\\ \mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- (* x.im (/ y.re y.im)) x.re) y.im))
        (t_1 (- (/ x.im y.re) (* x.re (* y.im (pow y.re -2.0)))))
        (t_2 (+ (* y.re y.re) (* y.im y.im))))
   (if (<= y.re -2.2e+135)
     t_1
     (if (<= y.re -1.1e-136)
       (/ (- (* y.re x.im) (* y.im x.re)) t_2)
       (if (<= y.re 3.3e-29)
         t_0
         (if (<= y.re 1.75e+44)
           (/ (fma (- y.im) x.re (* y.re x.im)) t_2)
           (if (<= y.re 9.6e+87) t_0 t_1)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double t_1 = (x_46_im / y_46_re) - (x_46_re * (y_46_im * pow(y_46_re, -2.0)));
	double t_2 = (y_46_re * y_46_re) + (y_46_im * y_46_im);
	double tmp;
	if (y_46_re <= -2.2e+135) {
		tmp = t_1;
	} else if (y_46_re <= -1.1e-136) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / t_2;
	} else if (y_46_re <= 3.3e-29) {
		tmp = t_0;
	} else if (y_46_re <= 1.75e+44) {
		tmp = fma(-y_46_im, x_46_re, (y_46_re * x_46_im)) / t_2;
	} else if (y_46_re <= 9.6e+87) {
		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(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	t_1 = Float64(Float64(x_46_im / y_46_re) - Float64(x_46_re * Float64(y_46_im * (y_46_re ^ -2.0))))
	t_2 = Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))
	tmp = 0.0
	if (y_46_re <= -2.2e+135)
		tmp = t_1;
	elseif (y_46_re <= -1.1e-136)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / t_2);
	elseif (y_46_re <= 3.3e-29)
		tmp = t_0;
	elseif (y_46_re <= 1.75e+44)
		tmp = Float64(fma(Float64(-y_46_im), x_46_re, Float64(y_46_re * x_46_im)) / t_2);
	elseif (y_46_re <= 9.6e+87)
		tmp = t_0;
	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[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, Block[{t$95$1 = 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$2 = N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.2e+135], t$95$1, If[LessEqual[y$46$re, -1.1e-136], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[y$46$re, 3.3e-29], t$95$0, If[LessEqual[y$46$re, 1.75e+44], N[(N[((-y$46$im) * x$46$re + N[(y$46$re * x$46$im), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[y$46$re, 9.6e+87], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\
t_1 := \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\
t_2 := y.re \cdot y.re + y.im \cdot y.im\\
\mathbf{if}\;y.re \leq -2.2 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;y.re \leq 3.3 \cdot 10^{-29}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{t\_2}\\

\mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -2.1999999999999999e135 or 9.59999999999999926e87 < y.re

    1. Initial program 34.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 73.6%

      \[\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. +-commutative73.6%

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

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - x.re \cdot \color{blue}{\left(y.im \cdot \frac{1}{{y.re}^{2}}\right)} \]
      2. pow-flip78.9%

        \[\leadsto \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot \color{blue}{{y.re}^{\left(-2\right)}}\right) \]
      3. metadata-eval78.9%

        \[\leadsto \frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{\color{blue}{-2}}\right) \]
    7. Applied egg-rr78.9%

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

    if -2.1999999999999999e135 < y.re < -1.1000000000000001e-136

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

    if -1.1000000000000001e-136 < y.re < 3.30000000000000028e-29 or 1.75e44 < y.re < 9.59999999999999926e87

    1. Initial program 65.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-sub60.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. *-commutative60.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. add-sqr-sqrt60.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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac61.9%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
      7. hypot-define64.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) \]
      8. associate-/l*70.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) \]
      9. add-sqr-sqrt70.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow270.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define70.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr70.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-identity70.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. unpow270.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-frac99.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. add-sqr-sqrt48.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod47.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg47.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod21.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt38.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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine33.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) \]
      10. +-commutative33.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) \]
      11. hypot-define38.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) \]
      12. add-sqr-sqrt21.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod47.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg47.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod48.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine70.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) \]
      18. +-commutative70.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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 82.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-182.1%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/82.7%

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

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

        \[\leadsto \color{blue}{x.im \cdot \frac{y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      5. *-lft-identity82.7%

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/88.7%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity88.7%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*90.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub91.4%

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

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

    if 3.30000000000000028e-29 < y.re < 1.75e44

    1. Initial program 89.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. sub-neg89.5%

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

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

        \[\leadsto \frac{\left(-\color{blue}{y.im \cdot x.re}\right) + x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. distribute-lft-neg-in89.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.2 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\ \mathbf{elif}\;y.re \leq -1.1 \cdot 10^{-136}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 3.3 \cdot 10^{-29}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-y.im, x.re, y.re \cdot x.im\right)}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - x.re \cdot \left(y.im \cdot {y.re}^{-2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 77.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ t_1 := \frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{if}\;y.re \leq -1.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.8 \cdot 10^{-135}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{-29}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- (* x.im (/ y.re y.im)) x.re) y.im))
        (t_1
         (/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))))
   (if (<= y.re -1.3e+135)
     (/ x.im y.re)
     (if (<= y.re -1.8e-135)
       t_1
       (if (<= y.re 2e-29)
         t_0
         (if (<= y.re 1.75e+44)
           t_1
           (if (<= y.re 9.6e+87) t_0 (/ x.im (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 / y_46_im)) - x_46_re) / y_46_im;
	double t_1 = ((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 tmp;
	if (y_46_re <= -1.3e+135) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -1.8e-135) {
		tmp = t_1;
	} else if (y_46_re <= 2e-29) {
		tmp = t_0;
	} else if (y_46_re <= 1.75e+44) {
		tmp = t_1;
	} else if (y_46_re <= 9.6e+87) {
		tmp = t_0;
	} else {
		tmp = x_46_im / hypot(y_46_im, y_46_re);
	}
	return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double t_1 = ((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 tmp;
	if (y_46_re <= -1.3e+135) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -1.8e-135) {
		tmp = t_1;
	} else if (y_46_re <= 2e-29) {
		tmp = t_0;
	} else if (y_46_re <= 1.75e+44) {
		tmp = t_1;
	} else if (y_46_re <= 9.6e+87) {
		tmp = t_0;
	} else {
		tmp = x_46_im / Math.hypot(y_46_im, y_46_re);
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	t_1 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	tmp = 0
	if y_46_re <= -1.3e+135:
		tmp = x_46_im / y_46_re
	elif y_46_re <= -1.8e-135:
		tmp = t_1
	elif y_46_re <= 2e-29:
		tmp = t_0
	elif y_46_re <= 1.75e+44:
		tmp = t_1
	elif y_46_re <= 9.6e+87:
		tmp = t_0
	else:
		tmp = x_46_im / math.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(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	t_1 = 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)))
	tmp = 0.0
	if (y_46_re <= -1.3e+135)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= -1.8e-135)
		tmp = t_1;
	elseif (y_46_re <= 2e-29)
		tmp = t_0;
	elseif (y_46_re <= 1.75e+44)
		tmp = t_1;
	elseif (y_46_re <= 9.6e+87)
		tmp = t_0;
	else
		tmp = Float64(x_46_im / hypot(y_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)
	t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	t_1 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	tmp = 0.0;
	if (y_46_re <= -1.3e+135)
		tmp = x_46_im / y_46_re;
	elseif (y_46_re <= -1.8e-135)
		tmp = t_1;
	elseif (y_46_re <= 2e-29)
		tmp = t_0;
	elseif (y_46_re <= 1.75e+44)
		tmp = t_1;
	elseif (y_46_re <= 9.6e+87)
		tmp = t_0;
	else
		tmp = x_46_im / hypot(y_46_im, y_46_re);
	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[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[y$46$re, -1.3e+135], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.8e-135], t$95$1, If[LessEqual[y$46$re, 2e-29], t$95$0, If[LessEqual[y$46$re, 1.75e+44], t$95$1, If[LessEqual[y$46$re, 9.6e+87], t$95$0, N[(x$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq -1.8 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y.re \leq 2 \cdot 10^{-29}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -1.3e135

    1. Initial program 30.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 77.3%

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

    if -1.3e135 < y.re < -1.79999999999999989e-135 or 1.99999999999999989e-29 < y.re < 1.75e44

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

    if -1.79999999999999989e-135 < y.re < 1.99999999999999989e-29 or 1.75e44 < y.re < 9.59999999999999926e87

    1. Initial program 65.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-sub60.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. *-commutative60.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. add-sqr-sqrt60.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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac61.9%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
      7. hypot-define64.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) \]
      8. associate-/l*70.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) \]
      9. add-sqr-sqrt70.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow270.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define70.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr70.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-identity70.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. unpow270.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-frac99.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. add-sqr-sqrt48.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod47.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg47.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod21.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt38.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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine33.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) \]
      10. +-commutative33.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) \]
      11. hypot-define38.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) \]
      12. add-sqr-sqrt21.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod47.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg47.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod48.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine70.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) \]
      18. +-commutative70.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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 82.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-182.1%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/82.7%

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

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

        \[\leadsto \color{blue}{x.im \cdot \frac{y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      5. *-lft-identity82.7%

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/88.7%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity88.7%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*90.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub91.4%

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

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

    if 9.59999999999999926e87 < y.re

    1. Initial program 37.7%

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

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

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

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{{y.re}^{2} + {y.im}^{2}}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      3. unpow238.1%

        \[\leadsto \frac{x.im \cdot y.re}{\sqrt{\color{blue}{y.re \cdot y.re} + {y.im}^{2}} \cdot \sqrt{{y.im}^{2} + {y.re}^{2}}} \]
      4. unpow238.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto y.re \cdot \frac{x.im}{{\color{blue}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^{2}} \]
      14. unpow239.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.re}^{2}} + y.im \cdot y.im}\right)}^{2}} \]
      15. unpow239.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{{y.re}^{2} + \color{blue}{{y.im}^{2}}}\right)}^{2}} \]
      16. +-commutative39.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{{y.im}^{2} + {y.re}^{2}}}\right)}^{2}} \]
      17. unpow239.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{\color{blue}{y.im \cdot y.im} + {y.re}^{2}}\right)}^{2}} \]
      18. unpow239.1%

        \[\leadsto y.re \cdot \frac{x.im}{{\left(\sqrt{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}}\right)}^{2}} \]
      19. hypot-define39.1%

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

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

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

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

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

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

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \color{blue}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}} \]
      6. unpow238.1%

        \[\leadsto \frac{y.re \cdot x.im}{\sqrt{{y.im}^{2} + y.re \cdot y.re} \cdot \sqrt{\color{blue}{{y.im}^{2}} + y.re \cdot y.re}} \]
      7. add-sqr-sqrt38.1%

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

        \[\leadsto \frac{y.re \cdot x.im}{\color{blue}{y.re \cdot y.re + {y.im}^{2}}} \]
      9. unpow238.1%

        \[\leadsto \frac{y.re \cdot x.im}{y.re \cdot y.re + \color{blue}{y.im \cdot y.im}} \]
      10. rem-square-sqrt38.1%

        \[\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}}} \]
      11. hypot-undefine38.1%

        \[\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}} \]
      12. hypot-undefine38.1%

        \[\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)}} \]
      13. frac-times80.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)}} \]
      14. associate-*l/80.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -1.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.8 \cdot 10^{-135}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{-29}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot x.im}{y.re \cdot y.re + y.im \cdot y.im}\\ t_1 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{if}\;y.re \leq -2.9 \cdot 10^{+92}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -3.1 \cdot 10^{-84}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq -6.6 \cdot 10^{-128}:\\ \;\;\;\;\frac{y.im \cdot x.re}{y.re \cdot \left(-y.re\right) - y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 7.2 \cdot 10^{-26}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq 2.7 \cdot 10^{+39}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+89}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (* y.re x.im) (+ (* y.re y.re) (* y.im y.im))))
        (t_1 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
   (if (<= y.re -2.9e+92)
     (/ x.im y.re)
     (if (<= y.re -3.1e-84)
       t_0
       (if (<= y.re -6.6e-128)
         (/ (* y.im x.re) (- (* y.re (- y.re)) (* y.im y.im)))
         (if (<= y.re 7.2e-26)
           t_1
           (if (<= y.re 2.7e+39)
             t_0
             (if (<= y.re 3.8e+89) t_1 (/ x.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 * x_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -2.9e+92) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -3.1e-84) {
		tmp = t_0;
	} else if (y_46_re <= -6.6e-128) {
		tmp = (y_46_im * x_46_re) / ((y_46_re * -y_46_re) - (y_46_im * y_46_im));
	} else if (y_46_re <= 7.2e-26) {
		tmp = t_1;
	} else if (y_46_re <= 2.7e+39) {
		tmp = t_0;
	} else if (y_46_re <= 3.8e+89) {
		tmp = t_1;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (y_46re * x_46im) / ((y_46re * y_46re) + (y_46im * y_46im))
    t_1 = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
    if (y_46re <= (-2.9d+92)) then
        tmp = x_46im / y_46re
    else if (y_46re <= (-3.1d-84)) then
        tmp = t_0
    else if (y_46re <= (-6.6d-128)) then
        tmp = (y_46im * x_46re) / ((y_46re * -y_46re) - (y_46im * y_46im))
    else if (y_46re <= 7.2d-26) then
        tmp = t_1
    else if (y_46re <= 2.7d+39) then
        tmp = t_0
    else if (y_46re <= 3.8d+89) then
        tmp = t_1
    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 t_0 = (y_46_re * x_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -2.9e+92) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -3.1e-84) {
		tmp = t_0;
	} else if (y_46_re <= -6.6e-128) {
		tmp = (y_46_im * x_46_re) / ((y_46_re * -y_46_re) - (y_46_im * y_46_im));
	} else if (y_46_re <= 7.2e-26) {
		tmp = t_1;
	} else if (y_46_re <= 2.7e+39) {
		tmp = t_0;
	} else if (y_46_re <= 3.8e+89) {
		tmp = t_1;
	} else {
		tmp = x_46_im / y_46_re;
	}
	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_re * y_46_re) + (y_46_im * y_46_im))
	t_1 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	tmp = 0
	if y_46_re <= -2.9e+92:
		tmp = x_46_im / y_46_re
	elif y_46_re <= -3.1e-84:
		tmp = t_0
	elif y_46_re <= -6.6e-128:
		tmp = (y_46_im * x_46_re) / ((y_46_re * -y_46_re) - (y_46_im * y_46_im))
	elif y_46_re <= 7.2e-26:
		tmp = t_1
	elif y_46_re <= 2.7e+39:
		tmp = t_0
	elif y_46_re <= 3.8e+89:
		tmp = t_1
	else:
		tmp = x_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(y_46_re * x_46_im) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
	t_1 = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_re <= -2.9e+92)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= -3.1e-84)
		tmp = t_0;
	elseif (y_46_re <= -6.6e-128)
		tmp = Float64(Float64(y_46_im * x_46_re) / Float64(Float64(y_46_re * Float64(-y_46_re)) - Float64(y_46_im * y_46_im)));
	elseif (y_46_re <= 7.2e-26)
		tmp = t_1;
	elseif (y_46_re <= 2.7e+39)
		tmp = t_0;
	elseif (y_46_re <= 3.8e+89)
		tmp = t_1;
	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)
	t_0 = (y_46_re * x_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	t_1 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	tmp = 0.0;
	if (y_46_re <= -2.9e+92)
		tmp = x_46_im / y_46_re;
	elseif (y_46_re <= -3.1e-84)
		tmp = t_0;
	elseif (y_46_re <= -6.6e-128)
		tmp = (y_46_im * x_46_re) / ((y_46_re * -y_46_re) - (y_46_im * y_46_im));
	elseif (y_46_re <= 7.2e-26)
		tmp = t_1;
	elseif (y_46_re <= 2.7e+39)
		tmp = t_0;
	elseif (y_46_re <= 3.8e+89)
		tmp = t_1;
	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_] := Block[{t$95$0 = N[(N[(y$46$re * x$46$im), $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[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$re, -2.9e+92], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -3.1e-84], t$95$0, If[LessEqual[y$46$re, -6.6e-128], N[(N[(y$46$im * x$46$re), $MachinePrecision] / N[(N[(y$46$re * (-y$46$re)), $MachinePrecision] - N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 7.2e-26], t$95$1, If[LessEqual[y$46$re, 2.7e+39], t$95$0, If[LessEqual[y$46$re, 3.8e+89], t$95$1, N[(x$46$im / y$46$re), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq -3.1 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq -6.6 \cdot 10^{-128}:\\
\;\;\;\;\frac{y.im \cdot x.re}{y.re \cdot \left(-y.re\right) - y.im \cdot y.im}\\

\mathbf{elif}\;y.re \leq 7.2 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y.re \leq 2.7 \cdot 10^{+39}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+89}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -2.9000000000000001e92 or 3.80000000000000023e89 < y.re

    1. Initial program 38.6%

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

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

    if -2.9000000000000001e92 < y.re < -3.10000000000000002e-84 or 7.2000000000000003e-26 < y.re < 2.70000000000000003e39

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

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

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
    5. Simplified65.4%

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

    if -3.10000000000000002e-84 < y.re < -6.6e-128

    1. Initial program 99.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 x.im around 0 85.5%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(x.re \cdot y.im\right)}}{y.re \cdot y.re + y.im \cdot y.im} \]
    4. Step-by-step derivation
      1. mul-1-neg85.5%

        \[\leadsto \frac{\color{blue}{-x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. distribute-rgt-neg-out85.5%

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

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

    if -6.6e-128 < y.re < 7.2000000000000003e-26 or 2.70000000000000003e39 < y.re < 3.80000000000000023e89

    1. Initial program 66.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-sub62.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. *-commutative62.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. add-sqr-sqrt62.0%

        \[\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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac62.9%

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

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

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

        \[\leadsto \mathsf{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) \]
      9. add-sqr-sqrt71.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow271.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define71.1%

        \[\leadsto \mathsf{fma}\left(\frac{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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr71.1%

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

        \[\leadsto \mathsf{fma}\left(\frac{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. unpow271.1%

        \[\leadsto \mathsf{fma}\left(\frac{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-frac99.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. add-sqr-sqrt49.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod48.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 \left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg48.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 \left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod21.1%

        \[\leadsto \mathsf{fma}\left(\frac{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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt38.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 \left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine33.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) \]
      10. +-commutative33.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) \]
      11. hypot-define38.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 \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) \]
      12. add-sqr-sqrt21.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod48.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 \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg48.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 \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod49.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine71.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      18. +-commutative71.1%

        \[\leadsto \mathsf{fma}\left(\frac{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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 81.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-181.7%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/82.2%

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

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

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

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/88.1%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity88.1%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*89.8%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub90.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.9 \cdot 10^{+92}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -3.1 \cdot 10^{-84}:\\ \;\;\;\;\frac{y.re \cdot x.im}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq -6.6 \cdot 10^{-128}:\\ \;\;\;\;\frac{y.im \cdot x.re}{y.re \cdot \left(-y.re\right) - y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 7.2 \cdot 10^{-26}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 2.7 \cdot 10^{+39}:\\ \;\;\;\;\frac{y.re \cdot x.im}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+89}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 77.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ t_1 := \frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{if}\;y.re \leq -2.25 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -5.2 \cdot 10^{-132}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq 2.4 \cdot 10^{-29}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- (* x.im (/ y.re y.im)) x.re) y.im))
        (t_1
         (/ (- (* y.re x.im) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))))
   (if (<= y.re -2.25e+135)
     (/ x.im y.re)
     (if (<= y.re -5.2e-132)
       t_1
       (if (<= y.re 2.4e-29)
         t_0
         (if (<= y.re 1.75e+44)
           t_1
           (if (<= y.re 9.6e+87) t_0 (/ x.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 / y_46_im)) - x_46_re) / y_46_im;
	double t_1 = ((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 tmp;
	if (y_46_re <= -2.25e+135) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -5.2e-132) {
		tmp = t_1;
	} else if (y_46_re <= 2.4e-29) {
		tmp = t_0;
	} else if (y_46_re <= 1.75e+44) {
		tmp = t_1;
	} else if (y_46_re <= 9.6e+87) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
    t_1 = ((y_46re * x_46im) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
    if (y_46re <= (-2.25d+135)) then
        tmp = x_46im / y_46re
    else if (y_46re <= (-5.2d-132)) then
        tmp = t_1
    else if (y_46re <= 2.4d-29) then
        tmp = t_0
    else if (y_46re <= 1.75d+44) then
        tmp = t_1
    else if (y_46re <= 9.6d+87) then
        tmp = t_0
    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 t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double t_1 = ((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 tmp;
	if (y_46_re <= -2.25e+135) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= -5.2e-132) {
		tmp = t_1;
	} else if (y_46_re <= 2.4e-29) {
		tmp = t_0;
	} else if (y_46_re <= 1.75e+44) {
		tmp = t_1;
	} else if (y_46_re <= 9.6e+87) {
		tmp = t_0;
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	t_1 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	tmp = 0
	if y_46_re <= -2.25e+135:
		tmp = x_46_im / y_46_re
	elif y_46_re <= -5.2e-132:
		tmp = t_1
	elif y_46_re <= 2.4e-29:
		tmp = t_0
	elif y_46_re <= 1.75e+44:
		tmp = t_1
	elif y_46_re <= 9.6e+87:
		tmp = t_0
	else:
		tmp = x_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(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	t_1 = 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)))
	tmp = 0.0
	if (y_46_re <= -2.25e+135)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= -5.2e-132)
		tmp = t_1;
	elseif (y_46_re <= 2.4e-29)
		tmp = t_0;
	elseif (y_46_re <= 1.75e+44)
		tmp = t_1;
	elseif (y_46_re <= 9.6e+87)
		tmp = t_0;
	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)
	t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	t_1 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	tmp = 0.0;
	if (y_46_re <= -2.25e+135)
		tmp = x_46_im / y_46_re;
	elseif (y_46_re <= -5.2e-132)
		tmp = t_1;
	elseif (y_46_re <= 2.4e-29)
		tmp = t_0;
	elseif (y_46_re <= 1.75e+44)
		tmp = t_1;
	elseif (y_46_re <= 9.6e+87)
		tmp = t_0;
	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_] := Block[{t$95$0 = N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[y$46$re, -2.25e+135], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -5.2e-132], t$95$1, If[LessEqual[y$46$re, 2.4e-29], t$95$0, If[LessEqual[y$46$re, 1.75e+44], t$95$1, If[LessEqual[y$46$re, 9.6e+87], t$95$0, N[(x$46$im / y$46$re), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq -5.2 \cdot 10^{-132}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y.re \leq 2.4 \cdot 10^{-29}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -2.25000000000000004e135 or 9.59999999999999926e87 < y.re

    1. Initial program 34.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 77.7%

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

    if -2.25000000000000004e135 < y.re < -5.2000000000000002e-132 or 2.39999999999999992e-29 < y.re < 1.75e44

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

    if -5.2000000000000002e-132 < y.re < 2.39999999999999992e-29 or 1.75e44 < y.re < 9.59999999999999926e87

    1. Initial program 65.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-sub60.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. *-commutative60.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. add-sqr-sqrt60.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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac61.9%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
      7. hypot-define64.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) \]
      8. associate-/l*70.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) \]
      9. add-sqr-sqrt70.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow270.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define70.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr70.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-identity70.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. unpow270.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-frac99.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. add-sqr-sqrt48.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod47.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg47.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod21.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt38.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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine33.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) \]
      10. +-commutative33.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) \]
      11. hypot-define38.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) \]
      12. add-sqr-sqrt21.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod47.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg47.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod48.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine70.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) \]
      18. +-commutative70.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) \]
      19. hypot-define99.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-rr99.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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 82.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-182.1%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/82.7%

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

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

        \[\leadsto \color{blue}{x.im \cdot \frac{y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      5. *-lft-identity82.7%

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

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

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/88.7%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity88.7%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*90.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub91.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -2.25 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq -5.2 \cdot 10^{-132}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 2.4 \cdot 10^{-29}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.75 \cdot 10^{+44}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 9.6 \cdot 10^{+87}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 72.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{if}\;y.re \leq -4.2 \cdot 10^{+90}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq 4.7 \cdot 10^{-26}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 5.3 \cdot 10^{+39}:\\ \;\;\;\;\frac{y.re \cdot x.im}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+88}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
   (if (<= y.re -4.2e+90)
     (/ x.im y.re)
     (if (<= y.re 4.7e-26)
       t_0
       (if (<= y.re 5.3e+39)
         (/ (* y.re x.im) (+ (* y.re y.re) (* y.im y.im)))
         (if (<= y.re 1.6e+88) t_0 (/ x.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 / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -4.2e+90) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= 4.7e-26) {
		tmp = t_0;
	} else if (y_46_re <= 5.3e+39) {
		tmp = (y_46_re * x_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	} else if (y_46_re <= 1.6e+88) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
    if (y_46re <= (-4.2d+90)) then
        tmp = x_46im / y_46re
    else if (y_46re <= 4.7d-26) then
        tmp = t_0
    else if (y_46re <= 5.3d+39) then
        tmp = (y_46re * x_46im) / ((y_46re * y_46re) + (y_46im * y_46im))
    else if (y_46re <= 1.6d+88) then
        tmp = t_0
    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 t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_re <= -4.2e+90) {
		tmp = x_46_im / y_46_re;
	} else if (y_46_re <= 4.7e-26) {
		tmp = t_0;
	} else if (y_46_re <= 5.3e+39) {
		tmp = (y_46_re * x_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	} else if (y_46_re <= 1.6e+88) {
		tmp = t_0;
	} else {
		tmp = x_46_im / y_46_re;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	tmp = 0
	if y_46_re <= -4.2e+90:
		tmp = x_46_im / y_46_re
	elif y_46_re <= 4.7e-26:
		tmp = t_0
	elif y_46_re <= 5.3e+39:
		tmp = (y_46_re * x_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	elif y_46_re <= 1.6e+88:
		tmp = t_0
	else:
		tmp = x_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(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_re <= -4.2e+90)
		tmp = Float64(x_46_im / y_46_re);
	elseif (y_46_re <= 4.7e-26)
		tmp = t_0;
	elseif (y_46_re <= 5.3e+39)
		tmp = Float64(Float64(y_46_re * x_46_im) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)));
	elseif (y_46_re <= 1.6e+88)
		tmp = t_0;
	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)
	t_0 = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	tmp = 0.0;
	if (y_46_re <= -4.2e+90)
		tmp = x_46_im / y_46_re;
	elseif (y_46_re <= 4.7e-26)
		tmp = t_0;
	elseif (y_46_re <= 5.3e+39)
		tmp = (y_46_re * x_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	elseif (y_46_re <= 1.6e+88)
		tmp = t_0;
	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_] := Block[{t$95$0 = N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$re, -4.2e+90], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 4.7e-26], t$95$0, If[LessEqual[y$46$re, 5.3e+39], N[(N[(y$46$re * x$46$im), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.6e+88], t$95$0, N[(x$46$im / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y.re \leq 4.7 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 5.3 \cdot 10^{+39}:\\
\;\;\;\;\frac{y.re \cdot x.im}{y.re \cdot y.re + y.im \cdot y.im}\\

\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+88}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -4.19999999999999961e90 or 1.5999999999999999e88 < y.re

    1. Initial program 39.4%

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

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

    if -4.19999999999999961e90 < y.re < 4.69999999999999989e-26 or 5.29999999999999979e39 < y.re < 1.5999999999999999e88

    1. Initial program 73.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub69.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. *-commutative69.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. add-sqr-sqrt69.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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac70.7%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
      7. hypot-define73.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) \]
      8. associate-/l*77.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) \]
      9. add-sqr-sqrt77.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow277.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define77.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr77.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-identity77.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. unpow277.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-frac99.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}{\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. add-sqr-sqrt46.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(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod51.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 \left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg51.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 \left(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod26.1%

        \[\leadsto \mathsf{fma}\left(\frac{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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt44.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.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine41.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 \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) \]
      10. +-commutative41.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 \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) \]
      11. hypot-define44.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) \]
      12. add-sqr-sqrt26.1%

        \[\leadsto \mathsf{fma}\left(\frac{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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod51.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 \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg51.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 \left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod46.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(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine77.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) \]
      18. +-commutative77.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) \]
      19. hypot-define99.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}{\mathsf{hypot}\left(y.im, y.re\right)}}\right)\right) \]
    6. Applied egg-rr99.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}{\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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 72.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-172.5%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/73.3%

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

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

        \[\leadsto \color{blue}{x.im \cdot \frac{y.re}{{y.im}^{2}} - \frac{x.re}{y.im}} \]
      5. *-lft-identity73.3%

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

        \[\leadsto x.im \cdot \frac{1 \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      7. times-frac77.5%

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/77.5%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity77.5%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*80.1%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub80.9%

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

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

    if 4.69999999999999989e-26 < y.re < 5.29999999999999979e39

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

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

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
    5. Simplified65.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -4.2 \cdot 10^{+90}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.re \leq 4.7 \cdot 10^{-26}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 5.3 \cdot 10^{+39}:\\ \;\;\;\;\frac{y.re \cdot x.im}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+88}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 72.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -1.45 \cdot 10^{+91} \lor \neg \left(y.re \leq 9.6 \cdot 10^{+87}\right):\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.re -1.45e+91) (not (<= y.re 9.6e+87)))
   (/ x.im y.re)
   (/ (- (* x.im (/ y.re y.im)) x.re) y.im)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_re <= -1.45e+91) || !(y_46_re <= 9.6e+87)) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: tmp
    if ((y_46re <= (-1.45d+91)) .or. (.not. (y_46re <= 9.6d+87))) then
        tmp = x_46im / y_46re
    else
        tmp = ((x_46im * (y_46re / y_46im)) - x_46re) / y_46im
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((y_46_re <= -1.45e+91) || !(y_46_re <= 9.6e+87)) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (y_46_re <= -1.45e+91) or not (y_46_re <= 9.6e+87):
		tmp = x_46_im / y_46_re
	else:
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((y_46_re <= -1.45e+91) || !(y_46_re <= 9.6e+87))
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = Float64(Float64(Float64(x_46_im * Float64(y_46_re / y_46_im)) - x_46_re) / y_46_im);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_re <= -1.45e+91) || ~((y_46_re <= 9.6e+87)))
		tmp = x_46_im / y_46_re;
	else
		tmp = ((x_46_im * (y_46_re / y_46_im)) - x_46_re) / y_46_im;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -1.45e+91], N[Not[LessEqual[y$46$re, 9.6e+87]], $MachinePrecision]], N[(x$46$im / y$46$re), $MachinePrecision], N[(N[(N[(x$46$im * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.45 \cdot 10^{+91} \lor \neg \left(y.re \leq 9.6 \cdot 10^{+87}\right):\\
\;\;\;\;\frac{x.im}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -1.45000000000000007e91 or 9.59999999999999926e87 < y.re

    1. Initial program 39.4%

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

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

    if -1.45000000000000007e91 < y.re < 9.59999999999999926e87

    1. Initial program 74.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-sub71.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. *-commutative71.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. add-sqr-sqrt71.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}}} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. times-frac72.4%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y.re}{\color{blue}{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{x.im}{\sqrt{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) \]
      7. hypot-define75.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) \]
      8. associate-/l*79.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) \]
      9. add-sqr-sqrt79.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{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\right) \]
      10. pow279.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{y.re \cdot y.re + y.im \cdot y.im}\right)}^{2}}}\right) \]
      11. hypot-define79.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(\mathsf{hypot}\left(y.re, y.im\right)\right)}}^{2}}\right) \]
    4. Applied egg-rr79.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-identity79.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. unpow279.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-frac99.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}{\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. add-sqr-sqrt47.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      5. sqrt-prod51.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      6. sqr-neg51.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.re, y.im\right)} \cdot \frac{\sqrt{\color{blue}{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      7. sqrt-unprod25.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.re, y.im\right)} \cdot \frac{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      8. add-sqr-sqrt47.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(\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{\color{blue}{-y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      9. hypot-undefine44.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) \]
      10. +-commutative44.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) \]
      11. hypot-define47.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(\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) \]
      12. add-sqr-sqrt25.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{\color{blue}{\sqrt{-y.im} \cdot \sqrt{-y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      13. sqrt-unprod51.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{\color{blue}{\sqrt{\left(-y.im\right) \cdot \left(-y.im\right)}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      14. sqr-neg51.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{\sqrt{\color{blue}{y.im \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      15. sqrt-prod47.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{\color{blue}{\sqrt{y.im} \cdot \sqrt{y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      16. add-sqr-sqrt99.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{\color{blue}{y.im}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right) \]
      17. hypot-undefine79.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) \]
      18. +-commutative79.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) \]
      19. hypot-define99.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}{\mathsf{hypot}\left(y.im, y.re\right)}}\right)\right) \]
    6. Applied egg-rr99.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}{\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. *-commutative99.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}{\left(\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}\right) \cdot x.re}\right) \]
      2. associate-*l/99.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}{\frac{1 \cdot \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}} \cdot x.re\right) \]
      3. *-un-lft-identity99.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)}, -\frac{\color{blue}{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)}}}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re\right) \]
      4. associate-*l/99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    8. Applied egg-rr99.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}{\frac{\frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}\right) \]
    9. Taylor expanded in y.re around 0 67.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    10. Step-by-step derivation
      1. neg-mul-167.9%

        \[\leadsto \color{blue}{\left(-\frac{x.re}{y.im}\right)} + \frac{x.im \cdot y.re}{{y.im}^{2}} \]
      2. associate-*r/68.8%

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

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

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

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

        \[\leadsto x.im \cdot \frac{1 \cdot y.re}{\color{blue}{y.im \cdot y.im}} - \frac{x.re}{y.im} \]
      7. times-frac72.5%

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

        \[\leadsto x.im \cdot \color{blue}{\left(\frac{y.re}{y.im} \cdot \frac{1}{y.im}\right)} - \frac{x.re}{y.im} \]
      9. associate-*r/72.5%

        \[\leadsto x.im \cdot \color{blue}{\frac{\frac{y.re}{y.im} \cdot 1}{y.im}} - \frac{x.re}{y.im} \]
      10. *-rgt-identity72.5%

        \[\leadsto x.im \cdot \frac{\color{blue}{\frac{y.re}{y.im}}}{y.im} - \frac{x.re}{y.im} \]
      11. associate-/l*75.4%

        \[\leadsto \color{blue}{\frac{x.im \cdot \frac{y.re}{y.im}}{y.im}} - \frac{x.re}{y.im} \]
      12. div-sub76.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -1.45 \cdot 10^{+91} \lor \neg \left(y.re \leq 9.6 \cdot 10^{+87}\right):\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im \cdot \frac{y.re}{y.im} - x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 62.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.02 \cdot 10^{+61} \lor \neg \left(y.im \leq 1.56 \cdot 10^{-58}\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 -1.02e+61) (not (<= y.im 1.56e-58)))
   (/ 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 <= -1.02e+61) || !(y_46_im <= 1.56e-58)) {
		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 <= (-1.02d+61)) .or. (.not. (y_46im <= 1.56d-58))) 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 <= -1.02e+61) || !(y_46_im <= 1.56e-58)) {
		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 <= -1.02e+61) or not (y_46_im <= 1.56e-58):
		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 <= -1.02e+61) || !(y_46_im <= 1.56e-58))
		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 <= -1.02e+61) || ~((y_46_im <= 1.56e-58)))
		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, -1.02e+61], N[Not[LessEqual[y$46$im, 1.56e-58]], $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 -1.02 \cdot 10^{+61} \lor \neg \left(y.im \leq 1.56 \cdot 10^{-58}\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 < -1.01999999999999999e61 or 1.56000000000000008e-58 < 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. Taylor expanded in y.re around 0 65.3%

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x.re}{y.im}} \]
      2. neg-mul-165.3%

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

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

    if -1.01999999999999999e61 < y.im < 1.56000000000000008e-58

    1. Initial program 71.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.02 \cdot 10^{+61} \lor \neg \left(y.im \leq 1.56 \cdot 10^{-58}\right):\\ \;\;\;\;\frac{x.re}{-y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 42.4% accurate, 5.0× speedup?

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

\\
\frac{x.im}{y.re}
\end{array}
Derivation
  1. Initial program 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. Taylor expanded in y.re around inf 44.4%

    \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  4. Final simplification44.4%

    \[\leadsto \frac{x.im}{y.re} \]
  5. Add Preprocessing

Reproduce

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