- Split input into 2 regimes
if (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))) < 6.959736641168597e+280
Initial program 14.1
\[\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-sqrt14.1
\[\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*14.0
\[\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}}}\]
if 6.959736641168597e+280 < (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
Initial program 61.2
\[\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-sqrt61.2
\[\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*61.2
\[\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}}}\]
Taylor expanded around -inf 60.1
\[\leadsto \frac{\color{blue}{-1 \cdot x.re}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Simplified60.1
\[\leadsto \frac{\color{blue}{-x.re}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
- Recombined 2 regimes into one program.
Final simplification25.6
\[\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 6.959736641168597 \cdot 10^{+280}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.im + x.re \cdot y.re}{\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{-x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\end{array}\]