\[\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.5 s
Input Error: 29.4
Output Error: 5.7
Log:
Profile: 🕒
\(\begin{cases} \frac{x.im}{y.im} & \text{when } y.im \le -4.152185822643052 \cdot 10^{+136} \\ \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} & \text{when } y.im \le -1.1022654491558348 \cdot 10^{-91} \\ \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{when } y.im \le 4.990643890565693 \cdot 10^{-128} \\ \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} & \text{when } y.im \le 1.0431026568679888 \cdot 10^{-46} \\ \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{when } y.im \le 5.500657540493106 \cdot 10^{+125} \\ \frac{x.im}{y.im} & \text{otherwise} \end{cases}\)

    if y.im < -4.152185822643052e+136 or 5.500657540493106e+125 < 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}\]
      41.1
    2. Using strategy rm
      41.1
    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)}}}\]
      41.3
    4. Applied add-exp-log to get
      \[\frac{\color{red}{x.re \cdot y.re + x.im \cdot y.im}}{e^{\log \left(y.re \cdot y.re + y.im \cdot y.im\right)}} \leadsto \frac{\color{blue}{e^{\log \left(x.re \cdot y.re + x.im \cdot y.im\right)}}}{e^{\log \left(y.re \cdot y.re + y.im \cdot y.im\right)}}\]
      52.7
    5. Applied div-exp to get
      \[\color{red}{\frac{e^{\log \left(x.re \cdot y.re + x.im \cdot y.im\right)}}{e^{\log \left(y.re \cdot y.re + y.im \cdot y.im\right)}}} \leadsto \color{blue}{e^{\log \left(x.re \cdot y.re + x.im \cdot y.im\right) - \log \left(y.re \cdot y.re + y.im \cdot y.im\right)}}\]
      52.7
    6. Applied taylor to get
      \[e^{\log \left(x.re \cdot y.re + x.im \cdot y.im\right) - \log \left(y.re \cdot y.re + y.im \cdot y.im\right)} \leadsto e^{\log x.im - \log y.im}\]
      48.9
    7. Taylor expanded around 0 to get
      \[\color{red}{e^{\log x.im - \log y.im}} \leadsto \color{blue}{e^{\log x.im - \log y.im}}\]
      48.9
    8. Applied simplify to get
      \[e^{\log x.im - \log y.im} \leadsto \frac{x.im}{y.im}\]
      0

    9. Applied final simplification

    if -4.152185822643052e+136 < y.im < -1.1022654491558348e-91

    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.5
    2. Using strategy rm
      18.5
    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}}\]
      18.5

    if -1.1022654491558348e-91 < y.im < 4.990643890565693e-128 or 1.0431026568679888e-46 < y.im < 5.500657540493106e+125

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      28.0
    2. Using strategy rm
      28.0
    3. Applied add-cube-cbrt 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[3]{y.re \cdot y.re + y.im \cdot y.im}\right)}^3}}\]
      28.4
    4. Applied simplify to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{\left(\sqrt[3]{y.re \cdot y.re + y.im \cdot y.im}\right)}}^3} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{\left(\sqrt[3]{{y.re}^2 + y.im \cdot y.im}\right)}}^3}\]
      28.4
    5. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\left(\sqrt[3]{{y.re}^2 + y.im \cdot y.im}\right)}^3} \leadsto \frac{x.re}{y.re} + \frac{y.im \cdot x.im}{{y.re}^2}\]
      7.7
    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}}\]
      7.7
    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}\]
      2.3

    8. Applied final simplification

    if 4.990643890565693e-128 < y.im < 1.0431026568679888e-46

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      14.0
    2. Using strategy rm
      14.0
    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}}\]
      14.0

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