\[\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: 25.9
Output Error: 16.8
Log:
Profile: 🕒
\(\begin{cases} \frac{b}{c} - \frac{a \cdot d}{c \cdot c} & \text{when } c \le -5.419122227930595 \cdot 10^{+127} \\ \frac{b \cdot c - a \cdot d}{{c}^2 + {d}^2} & \text{when } c \le 1.4423407179873904 \cdot 10^{+147} \\ \frac{b}{c} - \frac{a \cdot d}{c \cdot c} & \text{otherwise} \end{cases}\)

    if c < -5.419122227930595e+127 or 1.4423407179873904e+147 < c

    1. Started with
      \[\frac{b \cdot c - a \cdot d}{{c}^2 + {d}^2}\]
      44.0
    2. Using strategy rm
      44.0
    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}}\]
      44.0
    4. Using strategy rm
      44.0
    5. Applied add-cube-cbrt to get
      \[\left(b \cdot c - a \cdot d\right) \cdot \color{red}{\frac{1}{{c}^2 + {d}^2}} \leadsto \left(b \cdot c - a \cdot d\right) \cdot \color{blue}{{\left(\sqrt[3]{\frac{1}{{c}^2 + {d}^2}}\right)}^3}\]
      44.1
    6. Applied taylor to get
      \[\left(b \cdot c - a \cdot d\right) \cdot {\left(\sqrt[3]{\frac{1}{{c}^2 + {d}^2}}\right)}^3 \leadsto \frac{b}{c} - \frac{d \cdot a}{{c}^2}\]
      12.8
    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}}\]
      12.8
    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}\]
      12.8

    9. Applied final simplification

    if -5.419122227930595e+127 < c < 1.4423407179873904e+147

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

  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))))))