\[\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: 11.8 s
Input Error: 12.8
Output Error: 4.2
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 -2.9658735f+17 \\ \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 -2.2927467f-11 \\ \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{when } y.im \le 7.2074683f-26 \\ \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 2.5917628f+14 \\ \frac{y.re}{y.im} \cdot \frac{x.re}{y.im} + \frac{x.im}{y.im} & \text{otherwise} \end{cases}\)

    if y.im < -2.9658735f+17 or 2.5917628f+14 < 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}\]
      21.2
    2. Using strategy rm
      21.2
    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}}\]
      21.2
    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}\]
      21.2
    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}\]
      20.5
    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}\]
      20.5
    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}\]
      6.2
    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}}\]
      6.2
    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 -2.9658735f+17 < y.im < -2.2927467f-11 or 7.2074683f-26 < y.im < 2.5917628f+14

    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.3
    2. Using strategy rm
      8.3
    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.2
    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.2

    if -2.2927467f-11 < y.im < 7.2074683f-26

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      10.5
    2. Using strategy rm
      10.5
    3. Applied add-exp-log 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}{e^{\log \left(y.re \cdot y.re + y.im \cdot y.im\right)}}}\]
      11.8
    4. Applied simplify to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{e^{\color{red}{\log \left(y.re \cdot y.re + y.im \cdot y.im\right)}}} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{e^{\color{blue}{\log \left({y.re}^2 + y.im \cdot y.im\right)}}}\]
      11.8
    5. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{e^{\log \left({y.re}^2 + y.im \cdot y.im\right)}} \leadsto \frac{x.re}{y.re} + \frac{y.im \cdot x.im}{{y.re}^2}\]
      2.8
    6. 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}}\]
      2.8
    7. 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}\]
      1.3

    8. Applied final simplification

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