\[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
Test:
_divideComplex, real part
Bits:
128 bits
Bits error versus x.re
Bits error versus x.im
Bits error versus y.re
Bits error versus y.im
Time: 15.1 s
Input Error: 14.3
Output Error: 2.7
Log:
Profile: 🕒
\(\begin{cases} \frac{y.re}{y.im} \cdot \frac{x.re}{y.im} + \frac{x.im}{y.im} & \text{when } y.im \le -1461388.5f0 \\ \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{when } y.im \le 3.1068393f-18 \\ \frac{x.re \cdot y.re + x.im \cdot y.im}{{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}^2} & \text{when } y.im \le 4.759657f+20 \\ \frac{y.re}{y.im} \cdot \frac{x.re}{y.im} + \frac{x.im}{y.im} & \text{otherwise} \end{cases}\)

    if y.im < -1461388.5f0 or 4.759657f+20 < y.im

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      19.6
    2. Using strategy rm
      19.6
    3. Applied add-sqr-sqrt to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{\color{red}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^2}}\]
      19.6
    4. Applied simplify to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}}^2}\]
      19.6
    5. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{y.im}^2}\]
      18.2
    6. Taylor expanded around 0 to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{y.im}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{y.im}}^2}\]
      18.2
    7. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{y.im}^2} \leadsto \frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im}\]
      5.7
    8. Taylor expanded around 0 to get
      \[\color{red}{\frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im}} \leadsto \color{blue}{\frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im}}\]
      5.7
    9. Applied simplify to get
      \[\frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im} \leadsto \frac{y.re}{y.im} \cdot \frac{x.re}{y.im} + \frac{x.im}{y.im}\]
      0.3

    10. Applied final simplification

    if -1461388.5f0 < y.im < 3.1068393f-18

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      12.6
    2. Using strategy rm
      12.6
    3. Applied add-sqr-sqrt to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{\color{red}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^2}}\]
      12.6
    4. Applied simplify to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}}^2}\]
      12.6
    5. Using strategy rm
      12.6
    6. Applied add-exp-log to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{\left(e^{\log \left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}\right)}}^2}\]
      13.7
    7. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\left(e^{\log \left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}\right)}^2} \leadsto \frac{x.re}{y.re} + \frac{y.im \cdot x.im}{{y.re}^2}\]
      3.0
    8. Taylor expanded around inf to get
      \[\color{red}{\frac{x.re}{y.re} + \frac{y.im \cdot x.im}{{y.re}^2}} \leadsto \color{blue}{\frac{x.re}{y.re} + \frac{y.im \cdot x.im}{{y.re}^2}}\]
      3.0
    9. Applied simplify to get
      \[\frac{x.re}{y.re} + \frac{y.im \cdot x.im}{{y.re}^2} \leadsto \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re}\]
      0.8

    10. Applied final simplification

    if 3.1068393f-18 < y.im < 4.759657f+20

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      8.9
    2. Using strategy rm
      8.9
    3. Applied add-sqr-sqrt to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{\color{red}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{\color{blue}{{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}^2}}\]
      8.9
    4. Applied simplify to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}}^2}\]
      8.9

  1. Removed slow pow expressions

Original test:


(lambda ((x.re default) (x.im default) (y.re default) (y.im default))
  #:name "_divideComplex, real part"
  (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))