\[\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.5 s
Input Error: 25.9
Output Error: 12.7
Log:
Profile: 🕒
\(\begin{cases} \frac{x.im}{y.im} & \text{when } y.im \le -4.038116738229486 \cdot 10^{+128} \\ \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} & \text{when } y.im \le 2.8628520537620805 \cdot 10^{+105} \\ \frac{x.im}{y.im} & \text{otherwise} \end{cases}\)

    if y.im < -4.038116738229486e+128 or 2.8628520537620805e+105 < 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}\]
      40.5
    2. Using strategy rm
      40.5
    3. Applied add-exp-log to get
      \[\color{red}{\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \color{blue}{e^{\log \left(\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)}}\]
      43.0
    4. Applied taylor to get
      \[e^{\log \left(\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\right)} \leadsto e^{\log x.im - \log y.im}\]
      47.2
    5. Taylor expanded around 0 to get
      \[e^{\color{red}{\log x.im - \log y.im}} \leadsto e^{\color{blue}{\log x.im - \log y.im}}\]
      47.2
    6. Applied simplify to get
      \[e^{\log x.im - \log y.im} \leadsto \frac{x.im}{y.im}\]
      0

    7. Applied final simplification

    if -4.038116738229486e+128 < y.im < 2.8628520537620805e+105

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      18.8

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