- Split input into 3 regimes
if (* (/ 1 (hypot y.re y.im)) (/ (- (* y.re x.im) (* x.re y.im)) (hypot y.re y.im))) < -1.0277645719906967e+298
Initial program 62.3
\[\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-sqrt62.3
\[\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 *-un-lft-identity62.3
\[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{\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-frac62.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}}}\]
Simplified62.3
\[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Simplified61.2
\[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
Taylor expanded around 0 48.9
\[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(-1 \cdot x.re\right)}\]
Simplified48.9
\[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(-x.re\right)}\]
if -1.0277645719906967e+298 < (* (/ 1 (hypot y.re y.im)) (/ (- (* y.re x.im) (* x.re y.im)) (hypot y.re y.im))) < 8.712391404611975e+303
Initial program 13.8
\[\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-sqrt13.8
\[\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 *-un-lft-identity13.8
\[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{\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-frac13.8
\[\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}}}\]
Simplified13.8
\[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Simplified1.5
\[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
if 8.712391404611975e+303 < (* (/ 1 (hypot y.re y.im)) (/ (- (* y.re x.im) (* x.re y.im)) (hypot y.re y.im)))
Initial program 61.4
\[\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-sqrt61.4
\[\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 *-un-lft-identity61.4
\[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{\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-frac61.4
\[\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}}}\]
Simplified61.4
\[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
Simplified61.2
\[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
Taylor expanded around inf 49.1
\[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{x.im}\]
- Recombined 3 regimes into one program.
Final simplification13.6
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \le -1.0277645719906967 \cdot 10^{+298}:\\
\;\;\;\;\left(-x.re\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}\\
\mathbf{elif}\;\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \le 8.712391404611975 \cdot 10^{+303}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}\\
\end{array}\]