\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
Test:
_divideComplex, imaginary part
Bits:
128 bits
Bits error versus x.re
Bits error versus x.im
Bits error versus y.re
Bits error versus y.im
Time: 9.9 s
Input Error: 26.3
Output Error: 15.9
Log:
Profile: 🕒
\(\begin{cases} \frac{x.im}{y.re} - \frac{x.re \cdot y.im}{y.re \cdot y.re} & \text{when } y.re \le -1.3132841288171074 \cdot 10^{+71} \\ \left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{y.re \cdot y.re + y.im \cdot y.im} & \text{when } y.re \le 4.1994984566891225 \cdot 10^{+114} \\ \frac{x.im}{y.re} - \frac{x.re \cdot y.im}{y.re \cdot y.re} & \text{otherwise} \end{cases}\)

    if y.re < -1.3132841288171074e+71 or 4.1994984566891225e+114 < y.re

    1. Started with
      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      40.4
    2. Using strategy rm
      40.4
    3. Applied div-inv to get
      \[\color{red}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \color{blue}{\left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{y.re \cdot y.re + y.im \cdot y.im}}\]
      40.4
    4. Using strategy rm
      40.4
    5. Applied add-cbrt-cube to get
      \[\left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{\color{red}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{\color{blue}{\sqrt[3]{{\left(y.re \cdot y.re + y.im \cdot y.im\right)}^3}}}\]
      48.3
    6. Applied simplify to get
      \[\left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{\sqrt[3]{\color{red}{{\left(y.re \cdot y.re + y.im \cdot y.im\right)}^3}}} \leadsto \left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{\sqrt[3]{\color{blue}{{\left({y.re}^2 + y.im \cdot y.im\right)}^3}}}\]
      48.3
    7. Applied taylor to get
      \[\left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{\sqrt[3]{{\left({y.re}^2 + y.im \cdot y.im\right)}^3}} \leadsto \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{{y.re}^2}\]
      11.7
    8. Taylor expanded around inf to get
      \[\color{red}{\frac{x.im}{y.re} - \frac{y.im \cdot x.re}{{y.re}^2}} \leadsto \color{blue}{\frac{x.im}{y.re} - \frac{y.im \cdot x.re}{{y.re}^2}}\]
      11.7
    9. Applied simplify to get
      \[\frac{x.im}{y.re} - \frac{y.im \cdot x.re}{{y.re}^2} \leadsto \frac{x.im}{y.re} - \frac{x.re \cdot y.im}{y.re \cdot y.re}\]
      11.7

    10. Applied final simplification

    if -1.3132841288171074e+71 < y.re < 4.1994984566891225e+114

    1. Started with
      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      18.1
    2. Using strategy rm
      18.1
    3. Applied div-inv to get
      \[\color{red}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \color{blue}{\left(x.im \cdot y.re - x.re \cdot y.im\right) \cdot \frac{1}{y.re \cdot y.re + y.im \cdot y.im}}\]
      18.4

  1. Removed slow pow expressions

Original test:


(lambda ((x.re default) (x.im default) (y.re default) (y.im default))
  #:name "_divideComplex, imaginary part"
  (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))