- Split input into 2 regimes
if (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))) < 3.4957913056678415e+302
Initial program 13.6
\[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
- Using strategy
rm Applied add-sqr-sqrt13.6
\[\leadsto \frac{x.re \cdot y.re + x.im \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*13.6
\[\leadsto \color{blue}{\frac{\frac{x.re \cdot y.re + x.im \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 *-un-lft-identity13.6
\[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(x.re \cdot y.re + x.im \cdot y.im\right)}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Applied associate-/l*13.6
\[\leadsto \frac{\color{blue}{\frac{1}{\frac{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}{x.re \cdot y.re + x.im \cdot y.im}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
if 3.4957913056678415e+302 < (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
Initial program 62.3
\[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
- Using strategy
rm Applied add-sqr-sqrt62.3
\[\leadsto \frac{x.re \cdot y.re + x.im \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*62.3
\[\leadsto \color{blue}{\frac{\frac{x.re \cdot y.re + x.im \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 div-inv62.3
\[\leadsto \frac{\color{blue}{\left(x.re \cdot y.re + x.im \cdot y.im\right) \cdot \frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Taylor expanded around 0 60.1
\[\leadsto \frac{\color{blue}{x.im}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
- Recombined 2 regimes into one program.
Final simplification25.1
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{x.im \cdot y.im + x.re \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} \le 3.4957913056678415 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{\frac{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}{x.im \cdot y.im + x.re \cdot y.re}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\end{array}\]