\[\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.7 s
Input Error: 13.2
Output Error: 3.5
Log:
Profile: 🕒
\(\begin{cases} \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c} & \text{when } c \le -8.175654f+07 \\ \frac{a \cdot c + b \cdot d}{{c}^2 + {\left(\left|d\right|\right)}^2} & \text{when } c \le 6.602544f+08 \\ \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c} & \text{otherwise} \end{cases}\)

    if c < -8.175654f+07 or 6.602544f+08 < c

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

    7. Applied final simplification

    if -8.175654f+07 < c < 6.602544f+08

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