- Split input into 2 regimes
if (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))) < -inf.0 or 1.2978434507798444e+268 < (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
Initial program 60.0
\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
- Using strategy
rm Applied div-sub60.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}}\]
- Using strategy
rm Applied add-sqr-sqrt60.1
\[\leadsto \frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
Applied times-frac54.8
\[\leadsto \frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \color{blue}{\frac{x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
- Using strategy
rm Applied *-un-lft-identity54.8
\[\leadsto \frac{x.im \cdot y.re}{\color{blue}{1 \cdot \left(y.re \cdot y.re + y.im \cdot y.im\right)}} - \frac{x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Applied times-frac50.0
\[\leadsto \color{blue}{\frac{x.im}{1} \cdot \frac{y.re}{y.re \cdot y.re + y.im \cdot y.im}} - \frac{x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Simplified50.0
\[\leadsto \color{blue}{x.im} \cdot \frac{y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
if -inf.0 < (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))) < 1.2978434507798444e+268
Initial program 11.6
\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
- Using strategy
rm Applied add-sqr-sqrt11.6
\[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
Applied associate-/r*11.5
\[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
- Using strategy
rm Applied add-sqr-sqrt11.5
\[\leadsto \frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{\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}}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Applied sqrt-prod11.8
\[\leadsto \frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{\sqrt{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \sqrt{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Applied associate-/r*11.8
\[\leadsto \frac{\color{blue}{\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}{\sqrt{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
- Recombined 2 regimes into one program.
Final simplification22.7
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} = -\infty:\\
\;\;\;\;\frac{y.re}{y.re \cdot y.re + y.im \cdot y.im} \cdot x.im - \frac{x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\mathbf{elif}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \le 1.2978434507798444 \cdot 10^{+268}:\\
\;\;\;\;\frac{\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}{\sqrt{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y.re}{y.re \cdot y.re + y.im \cdot y.im} \cdot x.im - \frac{x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\end{array}\]