\[\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: 13.4 s
Input Error: 25.8
Output Error: 13.1
Log:
Profile: 🕒
\(\begin{cases} \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{when } y.re \le -5.162982533250585 \cdot 10^{+112} \\ \frac{{\left(\sqrt[3]{x.re \cdot y.re + x.im \cdot y.im}\right)}^3}{y.re \cdot y.re + y.im \cdot y.im} & \text{when } y.re \le 2.7263057341550588 \cdot 10^{+122} \\ \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{otherwise} \end{cases}\)

    if y.re < -5.162982533250585e+112 or 2.7263057341550588e+122 < y.re

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      41.4
    2. Using strategy rm
      41.4
    3. Applied div-inv 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}{\left(x.re \cdot y.re + x.im \cdot y.im\right) \cdot \frac{1}{y.re \cdot y.re + y.im \cdot y.im}}\]
      41.4
    4. Using strategy rm
      41.4
    5. Applied add-cube-cbrt to get
      \[\left(x.re \cdot y.re + x.im \cdot y.im\right) \cdot \color{red}{\frac{1}{y.re \cdot y.re + y.im \cdot y.im}} \leadsto \left(x.re \cdot y.re + x.im \cdot y.im\right) \cdot \color{blue}{{\left(\sqrt[3]{\frac{1}{y.re \cdot y.re + y.im \cdot y.im}}\right)}^3}\]
      41.5
    6. Applied taylor to get
      \[\left(x.re \cdot y.re + x.im \cdot y.im\right) \cdot {\left(\sqrt[3]{\frac{1}{y.re \cdot y.re + y.im \cdot y.im}}\right)}^3 \leadsto \frac{x.re}{y.re} + \frac{y.im \cdot x.im}{{y.re}^2}\]
      12.1
    7. 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}}\]
      12.1
    8. 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.9

    9. Applied final simplification

    if -5.162982533250585e+112 < y.re < 2.7263057341550588e+122

    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.3
    2. Using strategy rm
      18.3
    3. Applied add-cube-cbrt to get
      \[\frac{\color{red}{x.re \cdot y.re + x.im \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \leadsto \frac{\color{blue}{{\left(\sqrt[3]{x.re \cdot y.re + x.im \cdot y.im}\right)}^3}}{y.re \cdot y.re + y.im \cdot y.im}\]
      18.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))))