- Split input into 2 regimes
if (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))) < -1.7744675471879946e+308
Initial program 60.5
\[\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-cube-cbrt60.5
\[\leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{\color{blue}{\left(\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}\right) \cdot \sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}}\]
Applied associate-/r*60.5
\[\leadsto \color{blue}{\frac{\frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}}\]
Taylor expanded around 0 52.8
\[\leadsto \frac{\color{blue}{\left(x.re \cdot y.re\right) \cdot {\left(\frac{1}{{y.im}^{4}}\right)}^{\frac{1}{3}} + {\left(\frac{1}{y.im}\right)}^{\frac{1}{3}} \cdot x.im}}{\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}\]
Simplified41.3
\[\leadsto \frac{\color{blue}{x.im \cdot \frac{1}{\sqrt[3]{y.im}} + {\left({y.im}^{4}\right)}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \left(y.re \cdot x.re\right)}}{\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}}\]
if -1.7744675471879946e+308 < (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
Initial program 24.5
\[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
- Recombined 2 regimes into one program.
Final simplification25.2
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{y.re \cdot x.re + x.im \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re} \le -1.7744675471879946 \cdot 10^{+308}:\\
\;\;\;\;\frac{\frac{1}{\sqrt[3]{y.im}} \cdot x.im + {\left({y.im}^{4}\right)}^{\left(-\frac{1}{3}\right)} \cdot \left(y.re \cdot x.re\right)}{\sqrt[3]{y.im \cdot y.im + y.re \cdot y.re}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y.re \cdot x.re + x.im \cdot y.im}{y.im \cdot y.im + y.re \cdot y.re}\\
\end{array}\]