\[\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: 10.0 s
Input Error: 26.1
Output Error: 12.6
Log:
Profile: 🕒
\(\begin{cases} \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c} & \text{when } c \le -8.89023270141141 \cdot 10^{+107} \\ \left(a \cdot c + b \cdot d\right) \cdot \frac{1}{{c}^2 + {d}^2} & \text{when } c \le 1.0222346456089473 \cdot 10^{+104} \\ \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c} & \text{otherwise} \end{cases}\)

    if c < -8.89023270141141e+107 or 1.0222346456089473e+104 < c

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

    1. Started with
      \[\frac{a \cdot c + b \cdot d}{{c}^2 + {d}^2}\]
      18.4
    2. Using strategy rm
      18.4
    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}}\]
      18.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))))))