_divideComplex, imaginary part

Percentage Accurate: 61.8% → 97.3%
Time: 18.0s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 61.8% accurate, 1.0× speedup?

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

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

Alternative 1: 97.3% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (-
  (* (/ x.im (hypot y.im y.re)) (/ y.re (hypot y.im y.re)))
  (* (/ 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 ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / hypot(y_46_im, y_46_re))) - ((y_46_im / hypot(y_46_im, y_46_re)) * (x_46_re / hypot(y_46_im, y_46_re)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im / Math.hypot(y_46_im, y_46_re)) * (y_46_re / Math.hypot(y_46_im, y_46_re))) - ((y_46_im / Math.hypot(y_46_im, y_46_re)) * (x_46_re / Math.hypot(y_46_im, y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return ((x_46_im / math.hypot(y_46_im, y_46_re)) * (y_46_re / math.hypot(y_46_im, y_46_re))) - ((y_46_im / math.hypot(y_46_im, y_46_re)) * (x_46_re / math.hypot(y_46_im, y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(Float64(x_46_im / hypot(y_46_im, y_46_re)) * Float64(y_46_re / hypot(y_46_im, y_46_re))) - Float64(Float64(y_46_im / hypot(y_46_im, y_46_re)) * Float64(x_46_re / hypot(y_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 / hypot(y_46_im, y_46_re)) * (y_46_re / hypot(y_46_im, y_46_re))) - ((y_46_im / hypot(y_46_im, y_46_re)) * (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[(N[(x$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(x$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{y.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)}
\end{array}
Derivation
  1. Initial program 65.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-sub63.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. add-sqr-sqrt63.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \color{blue}{\frac{\frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.im}}} \]
  13. Step-by-step derivation
    1. clear-num96.5%

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

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

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

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

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

Alternative 2: 88.7% accurate, 0.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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))) < -inf.0

    1. Initial program 27.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-sub14.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 1.9999999999999999e247

    1. Initial program 83.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. *-un-lft-identity83.3%

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

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

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

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

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

        \[\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-define97.5%

        \[\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-rr97.5%

      \[\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 1.9999999999999999e247 < (/.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 13.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-sub11.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. add-sqr-sqrt11.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 83.7% accurate, 0.1× speedup?

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

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

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

\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{+70}:\\
\;\;\;\;\frac{x.im \cdot y.re + \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{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -3.0500000000000001e-77 or 3.89999999999999975e70 < y.re

    1. Initial program 55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.0500000000000001e-77 < y.re < 1.02e-141

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.02e-141 < y.re < 3.89999999999999975e70

    1. Initial program 83.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. prod-diff83.8%

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

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

        \[\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+83.8%

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

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

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

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

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

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

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

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

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

      \[\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} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -3.05 \cdot 10^{-77}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.im}}\\ \mathbf{elif}\;y.re \leq 1.02 \cdot 10^{-141}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 3.9 \cdot 10^{+70}:\\ \;\;\;\;\frac{x.im \cdot y.re + \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{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.im}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 83.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ t_1 := \frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -6.2 \cdot 10^{+23}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.im \leq -1.72 \cdot 10^{-141}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.26 \cdot 10^{-166}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.1 \cdot 10^{+56}:\\ \;\;\;\;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.re y.re) (* y.im y.im))))
        (t_1
         (-
          (* (/ x.im (hypot y.im y.re)) (/ y.re (hypot y.im y.re)))
          (/ x.re y.im))))
   (if (<= y.im -6.2e+23)
     t_1
     (if (<= y.im -1.72e-141)
       t_0
       (if (<= y.im 1.26e-166)
         (- (/ x.im y.re) (* y.im (/ (/ x.re y.re) y.re)))
         (if (<= y.im 1.1e+56) 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_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -6.2e+23) {
		tmp = t_1;
	} else if (y_46_im <= -1.72e-141) {
		tmp = t_0;
	} else if (y_46_im <= 1.26e-166) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 1.1e+56) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = ((x_46_im / Math.hypot(y_46_im, y_46_re)) * (y_46_re / Math.hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -6.2e+23) {
		tmp = t_1;
	} else if (y_46_im <= -1.72e-141) {
		tmp = t_0;
	} else if (y_46_im <= 1.26e-166) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 1.1e+56) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	t_1 = ((x_46_im / math.hypot(y_46_im, y_46_re)) * (y_46_re / math.hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im)
	tmp = 0
	if y_46_im <= -6.2e+23:
		tmp = t_1
	elif y_46_im <= -1.72e-141:
		tmp = t_0
	elif y_46_im <= 1.26e-166:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re))
	elif y_46_im <= 1.1e+56:
		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 * y_46_re) - 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(Float64(x_46_im / hypot(y_46_im, y_46_re)) * Float64(y_46_re / hypot(y_46_im, y_46_re))) - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -6.2e+23)
		tmp = t_1;
	elseif (y_46_im <= -1.72e-141)
		tmp = t_0;
	elseif (y_46_im <= 1.26e-166)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / y_46_re) / y_46_re)));
	elseif (y_46_im <= 1.1e+56)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	t_1 = ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im);
	tmp = 0.0;
	if (y_46_im <= -6.2e+23)
		tmp = t_1;
	elseif (y_46_im <= -1.72e-141)
		tmp = t_0;
	elseif (y_46_im <= 1.26e-166)
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	elseif (y_46_im <= 1.1e+56)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$im * y$46$re), $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[(N[(x$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -6.2e+23], t$95$1, If[LessEqual[y$46$im, -1.72e-141], t$95$0, If[LessEqual[y$46$im, 1.26e-166], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.1e+56], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -6.19999999999999941e23 or 1.10000000000000008e56 < y.im

    1. Initial program 48.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.19999999999999941e23 < y.im < -1.7199999999999999e-141 or 1.26e-166 < y.im < 1.10000000000000008e56

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

    if -1.7199999999999999e-141 < y.im < 1.26e-166

    1. Initial program 69.3%

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

      \[\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. +-commutative82.9%

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/82.8%

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

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

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

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

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

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\left(\frac{1}{y.re} \cdot \frac{x.re}{y.re}\right)} \cdot y.im \]
    8. Step-by-step derivation
      1. associate-*l/85.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -6.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.72 \cdot 10^{-141}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.26 \cdot 10^{-166}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.1 \cdot 10^{+56}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{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{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im}{y.re} - \frac{\frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.im}}\\ \mathbf{if}\;y.re \leq -6.2 \cdot 10^{-77}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 7.6 \cdot 10^{-138}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 7 \cdot 10^{+70}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (-
          (/ x.im y.re)
          (/ (/ x.re (hypot y.im y.re)) (/ (hypot y.im y.re) y.im)))))
   (if (<= y.re -6.2e-77)
     t_0
     (if (<= y.re 7.6e-138)
       (-
        (* (/ x.im (hypot y.im y.re)) (/ y.re (hypot y.im y.re)))
        (/ x.re y.im))
       (if (<= y.re 7e+70)
         (/ (- (* x.im y.re) (* y.im x.re)) (+ (* y.re y.re) (* y.im y.im)))
         t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im / y_46_re) - ((x_46_re / hypot(y_46_im, y_46_re)) / (hypot(y_46_im, y_46_re) / y_46_im));
	double tmp;
	if (y_46_re <= -6.2e-77) {
		tmp = t_0;
	} else if (y_46_re <= 7.6e-138) {
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im);
	} else if (y_46_re <= 7e+70) {
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	} else {
		tmp = t_0;
	}
	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) - ((x_46_re / Math.hypot(y_46_im, y_46_re)) / (Math.hypot(y_46_im, y_46_re) / y_46_im));
	double tmp;
	if (y_46_re <= -6.2e-77) {
		tmp = t_0;
	} else if (y_46_re <= 7.6e-138) {
		tmp = ((x_46_im / Math.hypot(y_46_im, y_46_re)) * (y_46_re / Math.hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im);
	} else if (y_46_re <= 7e+70) {
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = (x_46_im / y_46_re) - ((x_46_re / math.hypot(y_46_im, y_46_re)) / (math.hypot(y_46_im, y_46_re) / y_46_im))
	tmp = 0
	if y_46_re <= -6.2e-77:
		tmp = t_0
	elif y_46_re <= 7.6e-138:
		tmp = ((x_46_im / math.hypot(y_46_im, y_46_re)) * (y_46_re / math.hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im)
	elif y_46_re <= 7e+70:
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(x_46_im / y_46_re) - Float64(Float64(x_46_re / hypot(y_46_im, y_46_re)) / Float64(hypot(y_46_im, y_46_re) / y_46_im)))
	tmp = 0.0
	if (y_46_re <= -6.2e-77)
		tmp = t_0;
	elseif (y_46_re <= 7.6e-138)
		tmp = Float64(Float64(Float64(x_46_im / hypot(y_46_im, y_46_re)) * Float64(y_46_re / hypot(y_46_im, y_46_re))) - Float64(x_46_re / y_46_im));
	elseif (y_46_re <= 7e+70)
		tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(y_46_im * x_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = (x_46_im / y_46_re) - ((x_46_re / hypot(y_46_im, y_46_re)) / (hypot(y_46_im, y_46_re) / y_46_im));
	tmp = 0.0;
	if (y_46_re <= -6.2e-77)
		tmp = t_0;
	elseif (y_46_re <= 7.6e-138)
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / hypot(y_46_im, y_46_re))) - (x_46_re / y_46_im);
	elseif (y_46_re <= 7e+70)
		tmp = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(N[(x$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -6.2e-77], t$95$0, If[LessEqual[y$46$re, 7.6e-138], N[(N[(N[(x$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 7e+70], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.re < -6.20000000000000016e-77 or 7.00000000000000005e70 < y.re

    1. Initial program 55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.20000000000000016e-77 < y.re < 7.6000000000000005e-138

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.6000000000000005e-138 < y.re < 7.00000000000000005e70

    1. Initial program 83.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. Recombined 3 regimes into one program.
  4. Final simplification86.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -6.2 \cdot 10^{-77}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.im}}\\ \mathbf{elif}\;y.re \leq 7.6 \cdot 10^{-138}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 7 \cdot 10^{+70}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - \frac{\frac{x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{y.im}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 80.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.9 \cdot 10^{-141}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.26 \cdot 10^{-166}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 3.7 \cdot 10^{+86}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{y.im} - \frac{x.re}{y.im}\\ \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.re y.re) (* y.im y.im)))))
   (if (<= y.im -1.25e+24)
     (- (* (/ y.re y.im) (/ x.im y.im)) (/ x.re y.im))
     (if (<= y.im -1.9e-141)
       t_0
       (if (<= y.im 1.26e-166)
         (- (/ x.im y.re) (* y.im (/ (/ x.re y.re) y.re)))
         (if (<= y.im 3.7e+86)
           t_0
           (- (* (/ x.im (hypot y.im y.re)) (/ 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 t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	} else if (y_46_im <= -1.9e-141) {
		tmp = t_0;
	} else if (y_46_im <= 1.26e-166) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 3.7e+86) {
		tmp = t_0;
	} else {
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / y_46_im)) - (x_46_re / y_46_im);
	}
	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_re * y_46_re) + (y_46_im * y_46_im));
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	} else if (y_46_im <= -1.9e-141) {
		tmp = t_0;
	} else if (y_46_im <= 1.26e-166) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 3.7e+86) {
		tmp = t_0;
	} else {
		tmp = ((x_46_im / Math.hypot(y_46_im, y_46_re)) * (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):
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	tmp = 0
	if y_46_im <= -1.25e+24:
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im)
	elif y_46_im <= -1.9e-141:
		tmp = t_0
	elif y_46_im <= 1.26e-166:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re))
	elif y_46_im <= 3.7e+86:
		tmp = t_0
	else:
		tmp = ((x_46_im / math.hypot(y_46_im, y_46_re)) * (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)
	t_0 = Float64(Float64(Float64(x_46_im * y_46_re) - 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_im <= -1.25e+24)
		tmp = Float64(Float64(Float64(y_46_re / y_46_im) * Float64(x_46_im / y_46_im)) - Float64(x_46_re / y_46_im));
	elseif (y_46_im <= -1.9e-141)
		tmp = t_0;
	elseif (y_46_im <= 1.26e-166)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / y_46_re) / y_46_re)));
	elseif (y_46_im <= 3.7e+86)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(x_46_im / hypot(y_46_im, y_46_re)) * Float64(y_46_re / y_46_im)) - Float64(x_46_re / y_46_im));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	tmp = 0.0;
	if (y_46_im <= -1.25e+24)
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	elseif (y_46_im <= -1.9e-141)
		tmp = t_0;
	elseif (y_46_im <= 1.26e-166)
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	elseif (y_46_im <= 3.7e+86)
		tmp = t_0;
	else
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (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_] := Block[{t$95$0 = N[(N[(N[(x$46$im * y$46$re), $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$im, -1.25e+24], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -1.9e-141], t$95$0, If[LessEqual[y$46$im, 1.26e-166], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 3.7e+86], t$95$0, N[(N[(N[(x$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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


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

    1. Initial program 48.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-sub48.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. add-sqr-sqrt48.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25000000000000011e24 < y.im < -1.89999999999999993e-141 or 1.26e-166 < y.im < 3.69999999999999992e86

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

    if -1.89999999999999993e-141 < y.im < 1.26e-166

    1. Initial program 69.3%

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

      \[\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. +-commutative82.9%

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/82.8%

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

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

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

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

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

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\left(\frac{1}{y.re} \cdot \frac{x.re}{y.re}\right)} \cdot y.im \]
    8. Step-by-step derivation
      1. associate-*l/85.9%

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

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

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

    if 3.69999999999999992e86 < y.im

    1. Initial program 46.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-sub46.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.9 \cdot 10^{-141}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.26 \cdot 10^{-166}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 3.7 \cdot 10^{+86}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{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{y.re}{y.im} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 80.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{-x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -3.2 \cdot 10^{-141}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.26 \cdot 10^{-166}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.46 \cdot 10^{+86}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{y.im} - \frac{x.re}{y.im}\\ \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.re y.re) (* y.im y.im)))))
   (if (<= y.im -1.25e+24)
     (- (* (/ y.re (hypot y.im y.re)) (/ (- x.im) y.im)) (/ x.re y.im))
     (if (<= y.im -3.2e-141)
       t_0
       (if (<= y.im 1.26e-166)
         (- (/ x.im y.re) (* y.im (/ (/ x.re y.re) y.re)))
         (if (<= y.im 1.46e+86)
           t_0
           (- (* (/ x.im (hypot y.im y.re)) (/ 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 t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = ((y_46_re / hypot(y_46_im, y_46_re)) * (-x_46_im / y_46_im)) - (x_46_re / y_46_im);
	} else if (y_46_im <= -3.2e-141) {
		tmp = t_0;
	} else if (y_46_im <= 1.26e-166) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 1.46e+86) {
		tmp = t_0;
	} else {
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / y_46_im)) - (x_46_re / y_46_im);
	}
	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_re * y_46_re) + (y_46_im * y_46_im));
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = ((y_46_re / Math.hypot(y_46_im, y_46_re)) * (-x_46_im / y_46_im)) - (x_46_re / y_46_im);
	} else if (y_46_im <= -3.2e-141) {
		tmp = t_0;
	} else if (y_46_im <= 1.26e-166) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 1.46e+86) {
		tmp = t_0;
	} else {
		tmp = ((x_46_im / Math.hypot(y_46_im, y_46_re)) * (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):
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	tmp = 0
	if y_46_im <= -1.25e+24:
		tmp = ((y_46_re / math.hypot(y_46_im, y_46_re)) * (-x_46_im / y_46_im)) - (x_46_re / y_46_im)
	elif y_46_im <= -3.2e-141:
		tmp = t_0
	elif y_46_im <= 1.26e-166:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re))
	elif y_46_im <= 1.46e+86:
		tmp = t_0
	else:
		tmp = ((x_46_im / math.hypot(y_46_im, y_46_re)) * (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)
	t_0 = Float64(Float64(Float64(x_46_im * y_46_re) - 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_im <= -1.25e+24)
		tmp = Float64(Float64(Float64(y_46_re / hypot(y_46_im, y_46_re)) * Float64(Float64(-x_46_im) / y_46_im)) - Float64(x_46_re / y_46_im));
	elseif (y_46_im <= -3.2e-141)
		tmp = t_0;
	elseif (y_46_im <= 1.26e-166)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / y_46_re) / y_46_re)));
	elseif (y_46_im <= 1.46e+86)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(x_46_im / hypot(y_46_im, y_46_re)) * Float64(y_46_re / y_46_im)) - Float64(x_46_re / y_46_im));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	tmp = 0.0;
	if (y_46_im <= -1.25e+24)
		tmp = ((y_46_re / hypot(y_46_im, y_46_re)) * (-x_46_im / y_46_im)) - (x_46_re / y_46_im);
	elseif (y_46_im <= -3.2e-141)
		tmp = t_0;
	elseif (y_46_im <= 1.26e-166)
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	elseif (y_46_im <= 1.46e+86)
		tmp = t_0;
	else
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (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_] := Block[{t$95$0 = N[(N[(N[(x$46$im * y$46$re), $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$im, -1.25e+24], N[(N[(N[(y$46$re / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[((-x$46$im) / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -3.2e-141], t$95$0, If[LessEqual[y$46$im, 1.26e-166], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.46e+86], t$95$0, N[(N[(N[(x$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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


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

    1. Initial program 48.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-sub48.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. add-sqr-sqrt48.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25000000000000011e24 < y.im < -3.2000000000000001e-141 or 1.26e-166 < y.im < 1.46e86

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

    if -3.2000000000000001e-141 < y.im < 1.26e-166

    1. Initial program 69.3%

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

      \[\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. +-commutative82.9%

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/82.8%

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

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

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

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

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

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\left(\frac{1}{y.re} \cdot \frac{x.re}{y.re}\right)} \cdot y.im \]
    8. Step-by-step derivation
      1. associate-*l/85.9%

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

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

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

    if 1.46e86 < y.im

    1. Initial program 46.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-sub46.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;\frac{y.re}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{-x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -3.2 \cdot 10^{-141}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.26 \cdot 10^{-166}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 1.46 \cdot 10^{+86}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{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{y.re}{y.im} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 79.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;\frac{-y.re}{y.im \cdot \frac{\mathsf{hypot}\left(y.im, y.re\right)}{x.im}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -9.2 \cdot 10^{-142}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 1.2 \cdot 10^{-172}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.7 \cdot 10^{+86}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)} \cdot \frac{y.re}{y.im} - \frac{x.re}{y.im}\\ \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.re y.re) (* y.im y.im)))))
   (if (<= y.im -1.25e+24)
     (- (/ (- y.re) (* y.im (/ (hypot y.im y.re) x.im))) (/ x.re y.im))
     (if (<= y.im -9.2e-142)
       t_0
       (if (<= y.im 1.2e-172)
         (- (/ x.im y.re) (* y.im (/ (/ x.re y.re) y.re)))
         (if (<= y.im 4.7e+86)
           t_0
           (- (* (/ x.im (hypot y.im y.re)) (/ 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 t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = (-y_46_re / (y_46_im * (hypot(y_46_im, y_46_re) / x_46_im))) - (x_46_re / y_46_im);
	} else if (y_46_im <= -9.2e-142) {
		tmp = t_0;
	} else if (y_46_im <= 1.2e-172) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 4.7e+86) {
		tmp = t_0;
	} else {
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (y_46_re / y_46_im)) - (x_46_re / y_46_im);
	}
	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_re * y_46_re) + (y_46_im * y_46_im));
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = (-y_46_re / (y_46_im * (Math.hypot(y_46_im, y_46_re) / x_46_im))) - (x_46_re / y_46_im);
	} else if (y_46_im <= -9.2e-142) {
		tmp = t_0;
	} else if (y_46_im <= 1.2e-172) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 4.7e+86) {
		tmp = t_0;
	} else {
		tmp = ((x_46_im / Math.hypot(y_46_im, y_46_re)) * (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):
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	tmp = 0
	if y_46_im <= -1.25e+24:
		tmp = (-y_46_re / (y_46_im * (math.hypot(y_46_im, y_46_re) / x_46_im))) - (x_46_re / y_46_im)
	elif y_46_im <= -9.2e-142:
		tmp = t_0
	elif y_46_im <= 1.2e-172:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re))
	elif y_46_im <= 4.7e+86:
		tmp = t_0
	else:
		tmp = ((x_46_im / math.hypot(y_46_im, y_46_re)) * (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)
	t_0 = Float64(Float64(Float64(x_46_im * y_46_re) - 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_im <= -1.25e+24)
		tmp = Float64(Float64(Float64(-y_46_re) / Float64(y_46_im * Float64(hypot(y_46_im, y_46_re) / x_46_im))) - Float64(x_46_re / y_46_im));
	elseif (y_46_im <= -9.2e-142)
		tmp = t_0;
	elseif (y_46_im <= 1.2e-172)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / y_46_re) / y_46_re)));
	elseif (y_46_im <= 4.7e+86)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(x_46_im / hypot(y_46_im, y_46_re)) * Float64(y_46_re / y_46_im)) - Float64(x_46_re / y_46_im));
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	tmp = 0.0;
	if (y_46_im <= -1.25e+24)
		tmp = (-y_46_re / (y_46_im * (hypot(y_46_im, y_46_re) / x_46_im))) - (x_46_re / y_46_im);
	elseif (y_46_im <= -9.2e-142)
		tmp = t_0;
	elseif (y_46_im <= 1.2e-172)
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	elseif (y_46_im <= 4.7e+86)
		tmp = t_0;
	else
		tmp = ((x_46_im / hypot(y_46_im, y_46_re)) * (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_] := Block[{t$95$0 = N[(N[(N[(x$46$im * y$46$re), $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$im, -1.25e+24], N[(N[((-y$46$re) / N[(y$46$im * N[(N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -9.2e-142], t$95$0, If[LessEqual[y$46$im, 1.2e-172], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.7e+86], t$95$0, N[(N[(N[(x$46$im / N[Sqrt[y$46$im ^ 2 + y$46$re ^ 2], $MachinePrecision]), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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


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

    1. Initial program 48.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-sub48.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. add-sqr-sqrt48.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25000000000000011e24 < y.im < -9.20000000000000009e-142 or 1.2e-172 < y.im < 4.7000000000000002e86

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

    if -9.20000000000000009e-142 < y.im < 1.2e-172

    1. Initial program 69.3%

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

      \[\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. +-commutative82.9%

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/82.8%

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

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

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

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

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

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\left(\frac{1}{y.re} \cdot \frac{x.re}{y.re}\right)} \cdot y.im \]
    8. Step-by-step derivation
      1. associate-*l/85.9%

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

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

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

    if 4.7000000000000002e86 < y.im

    1. Initial program 46.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-sub46.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;\frac{-y.re}{y.im \cdot \frac{\mathsf{hypot}\left(y.im, y.re\right)}{x.im}} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -9.2 \cdot 10^{-142}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 1.2 \cdot 10^{-172}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.7 \cdot 10^{+86}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{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{y.re}{y.im} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 80.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ t_1 := \frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y.im \leq -1.2 \cdot 10^{-141}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 2.9 \cdot 10^{-167}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.1 \cdot 10^{+86}:\\ \;\;\;\;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.re y.re) (* y.im y.im))))
        (t_1 (- (* (/ y.re y.im) (/ x.im y.im)) (/ x.re y.im))))
   (if (<= y.im -1.25e+24)
     t_1
     (if (<= y.im -1.2e-141)
       t_0
       (if (<= y.im 2.9e-167)
         (- (/ x.im y.re) (* y.im (/ (/ x.re y.re) y.re)))
         (if (<= y.im 4.1e+86) 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_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = t_1;
	} else if (y_46_im <= -1.2e-141) {
		tmp = t_0;
	} else if (y_46_im <= 2.9e-167) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 4.1e+86) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ((x_46im * y_46re) - (y_46im * x_46re)) / ((y_46re * y_46re) + (y_46im * y_46im))
    t_1 = ((y_46re / y_46im) * (x_46im / y_46im)) - (x_46re / y_46im)
    if (y_46im <= (-1.25d+24)) then
        tmp = t_1
    else if (y_46im <= (-1.2d-141)) then
        tmp = t_0
    else if (y_46im <= 2.9d-167) then
        tmp = (x_46im / y_46re) - (y_46im * ((x_46re / y_46re) / y_46re))
    else if (y_46im <= 4.1d+86) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	double t_1 = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	double tmp;
	if (y_46_im <= -1.25e+24) {
		tmp = t_1;
	} else if (y_46_im <= -1.2e-141) {
		tmp = t_0;
	} else if (y_46_im <= 2.9e-167) {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	} else if (y_46_im <= 4.1e+86) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
	t_1 = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im)
	tmp = 0
	if y_46_im <= -1.25e+24:
		tmp = t_1
	elif y_46_im <= -1.2e-141:
		tmp = t_0
	elif y_46_im <= 2.9e-167:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re))
	elif y_46_im <= 4.1e+86:
		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 * y_46_re) - 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(Float64(y_46_re / y_46_im) * Float64(x_46_im / y_46_im)) - Float64(x_46_re / y_46_im))
	tmp = 0.0
	if (y_46_im <= -1.25e+24)
		tmp = t_1;
	elseif (y_46_im <= -1.2e-141)
		tmp = t_0;
	elseif (y_46_im <= 2.9e-167)
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / y_46_re) / y_46_re)));
	elseif (y_46_im <= 4.1e+86)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = ((x_46_im * y_46_re) - (y_46_im * x_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	t_1 = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	tmp = 0.0;
	if (y_46_im <= -1.25e+24)
		tmp = t_1;
	elseif (y_46_im <= -1.2e-141)
		tmp = t_0;
	elseif (y_46_im <= 2.9e-167)
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / y_46_re));
	elseif (y_46_im <= 4.1e+86)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$im * y$46$re), $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[(N[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.25e+24], t$95$1, If[LessEqual[y$46$im, -1.2e-141], t$95$0, If[LessEqual[y$46$im, 2.9e-167], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.1e+86], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y.im < -1.25000000000000011e24 or 4.0999999999999999e86 < y.im

    1. Initial program 47.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-sub47.5%

        \[\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. add-sqr-sqrt47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25000000000000011e24 < y.im < -1.2e-141 or 2.90000000000000003e-167 < y.im < 4.0999999999999999e86

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

    if -1.2e-141 < y.im < 2.90000000000000003e-167

    1. Initial program 69.3%

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

      \[\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. +-commutative82.9%

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/82.8%

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

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

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

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

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

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\left(\frac{1}{y.re} \cdot \frac{x.re}{y.re}\right)} \cdot y.im \]
    8. Step-by-step derivation
      1. associate-*l/85.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.25 \cdot 10^{+24}:\\ \;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -1.2 \cdot 10^{-141}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq 2.9 \cdot 10^{-167}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 4.1 \cdot 10^{+86}:\\ \;\;\;\;\frac{x.im \cdot y.re - y.im \cdot x.re}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -9.2 \cdot 10^{-51} \lor \neg \left(y.im \leq 4 \cdot 10^{+48}\right):\\
\;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \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 < -9.20000000000000007e-51 or 4.00000000000000018e48 < y.im

    1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.20000000000000007e-51 < y.im < 4.00000000000000018e48

    1. Initial program 75.7%

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

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

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

Alternative 11: 75.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -1.3 \cdot 10^{-33} \lor \neg \left(y.im \leq 4.2 \cdot 10^{+48}\right):\\ \;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re} - y.im \cdot \frac{\frac{x.re}{y.re}}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= y.im -1.3e-33) (not (<= y.im 4.2e+48)))
   (- (* (/ y.re y.im) (/ x.im y.im)) (/ x.re y.im))
   (- (/ x.im y.re) (* y.im (/ (/ x.re y.re) 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.3e-33) || !(y_46_im <= 4.2e+48)) {
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	} else {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / 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.3d-33)) .or. (.not. (y_46im <= 4.2d+48))) then
        tmp = ((y_46re / y_46im) * (x_46im / y_46im)) - (x_46re / y_46im)
    else
        tmp = (x_46im / y_46re) - (y_46im * ((x_46re / y_46re) / 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.3e-33) || !(y_46_im <= 4.2e+48)) {
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	} else {
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / 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.3e-33) or not (y_46_im <= 4.2e+48):
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im)
	else:
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / 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.3e-33) || !(y_46_im <= 4.2e+48))
		tmp = Float64(Float64(Float64(y_46_re / y_46_im) * Float64(x_46_im / y_46_im)) - Float64(x_46_re / y_46_im));
	else
		tmp = Float64(Float64(x_46_im / y_46_re) - Float64(y_46_im * Float64(Float64(x_46_re / y_46_re) / 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.3e-33) || ~((y_46_im <= 4.2e+48)))
		tmp = ((y_46_re / y_46_im) * (x_46_im / y_46_im)) - (x_46_re / y_46_im);
	else
		tmp = (x_46_im / y_46_re) - (y_46_im * ((x_46_re / y_46_re) / 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.3e-33], N[Not[LessEqual[y$46$im, 4.2e+48]], $MachinePrecision]], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision] - N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(y$46$im * N[(N[(x$46$re / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.3 \cdot 10^{-33} \lor \neg \left(y.im \leq 4.2 \cdot 10^{+48}\right):\\
\;\;\;\;\frac{y.re}{y.im} \cdot \frac{x.im}{y.im} - \frac{x.re}{y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -1.29999999999999997e-33 or 4.1999999999999997e48 < y.im

    1. Initial program 52.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.29999999999999997e-33 < y.im < 4.1999999999999997e48

    1. Initial program 76.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 74.1%

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

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

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

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

        \[\leadsto \frac{x.im}{y.re} - \color{blue}{\frac{x.re}{\frac{{y.re}^{2}}{y.im}}} \]
      5. associate-/r/73.2%

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

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

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

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

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

      \[\leadsto \frac{x.im}{y.re} - \color{blue}{\left(\frac{1}{y.re} \cdot \frac{x.re}{y.re}\right)} \cdot y.im \]
    8. Step-by-step derivation
      1. associate-*l/76.8%

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

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

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

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

Alternative 12: 64.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2.1 \cdot 10^{-5} \lor \neg \left(y.im \leq 4.3 \cdot 10^{+48}\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 -2.1e-5) (not (<= y.im 4.3e+48)))
   (/ (- 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 <= -2.1e-5) || !(y_46_im <= 4.3e+48)) {
		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 <= (-2.1d-5)) .or. (.not. (y_46im <= 4.3d+48))) 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 <= -2.1e-5) || !(y_46_im <= 4.3e+48)) {
		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 <= -2.1e-5) or not (y_46_im <= 4.3e+48):
		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 <= -2.1e-5) || !(y_46_im <= 4.3e+48))
		tmp = Float64(Float64(-x_46_re) / y_46_im);
	else
		tmp = Float64(x_46_im / y_46_re);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((y_46_im <= -2.1e-5) || ~((y_46_im <= 4.3e+48)))
		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, -2.1e-5], N[Not[LessEqual[y$46$im, 4.3e+48]], $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 -2.1 \cdot 10^{-5} \lor \neg \left(y.im \leq 4.3 \cdot 10^{+48}\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 < -2.09999999999999988e-5 or 4.29999999999999978e48 < y.im

    1. Initial program 50.2%

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

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

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

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

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

    if -2.09999999999999988e-5 < y.im < 4.29999999999999978e48

    1. Initial program 77.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 63.4%

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

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

Alternative 13: 42.6% 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 65.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 41.4%

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

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

Reproduce

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