\[\frac{a \cdot c + b \cdot d}{{c}^2 + {d}^2}\]
Test:
Complex division, real part
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Bits error versus d
Time: 11.9 s
Input Error: 26.3
Output Error: 11.5
Log:
Profile: 🕒
\(\begin{cases} \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c} & \text{when } c \le -5.671665100714436 \cdot 10^{+89} \\ \frac{a \cdot c + b \cdot d}{{c}^2 + {d}^2} & \text{when } c \le 6.209412377058245 \cdot 10^{+96} \\ \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c} & \text{otherwise} \end{cases}\)

    if c < -5.671665100714436e+89 or 6.209412377058245e+96 < c

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

    9. Applied final simplification

    if -5.671665100714436e+89 < c < 6.209412377058245e+96

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

  1. Removed slow pow expressions

Original test:


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