\[\frac{b \cdot c - a \cdot d}{{c}^2 + {d}^2}\]
Test:
Complex division, imag part
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Bits error versus d
Time: 10.3 s
Input Error: 26.3
Output Error: 15.8
Log:
Profile: 🕒
\(\begin{cases} \frac{b}{c} - \frac{a \cdot d}{c \cdot c} & \text{when } c \le -1.3132841288171074 \cdot 10^{+71} \\ \frac{b \cdot c - a \cdot d}{{c}^2 + {d}^2} & \text{when } c \le 4.1994984566891225 \cdot 10^{+114} \\ \frac{b}{c} - \frac{a \cdot d}{c \cdot c} & \text{otherwise} \end{cases}\)

    if c < -1.3132841288171074e+71 or 4.1994984566891225e+114 < c

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

    9. Applied final simplification

    if -1.3132841288171074e+71 < c < 4.1994984566891225e+114

    1. Started with
      \[\frac{b \cdot c - a \cdot d}{{c}^2 + {d}^2}\]
      18.1

  1. Removed slow pow expressions

Original test:


(lambda ((a default) (b default) (c default) (d default))
  #:name "Complex division, imag part"
  (/ (- (* b c) (* a d)) (+ (sqr c) (sqr d)))
  #:target
  (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))