\[\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: 17.4 s
Input Error: 14.4
Output Error: 3.7
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 -1.674345f+14 \\ \frac{1}{\frac{{y.re}^2 + y.im \cdot y.im}{y.re \cdot x.re + x.im \cdot y.im}} & \text{when } y.re \le -1.8106279f-24 \\ \frac{x.im}{y.im} & \text{when } y.re \le 2.9946338f-12 \\ \frac{1}{\frac{{y.re}^2 + y.im \cdot y.im}{y.re \cdot x.re + x.im \cdot y.im}} & \text{when } y.re \le 6.144087f+15 \\ \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{otherwise} \end{cases}\)

    if y.re < -1.674345f+14 or 6.144087f+15 < 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}\]
      21.3
    2. Using strategy rm
      21.3
    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}}\]
      21.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}\]
      21.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}\]
      5.9
    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}}\]
      5.9
    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}\]
      0.3

    8. Applied final simplification

    if -1.674345f+14 < y.re < -1.8106279f-24 or 2.9946338f-12 < y.re < 6.144087f+15

    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.0
    2. Using strategy rm
      8.0
    3. Applied clear-num 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}{\frac{1}{\frac{y.re \cdot y.re + y.im \cdot y.im}{x.re \cdot y.re + x.im \cdot y.im}}}\]
      8.2
    4. Applied simplify to get
      \[\frac{1}{\color{red}{\frac{y.re \cdot y.re + y.im \cdot y.im}{x.re \cdot y.re + x.im \cdot y.im}}} \leadsto \frac{1}{\color{blue}{\frac{{y.re}^2 + y.im \cdot y.im}{y.re \cdot x.re + x.im \cdot y.im}}}\]
      8.2

    if -1.8106279f-24 < y.re < 2.9946338f-12

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      16.3
    2. Using strategy rm
      16.3
    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)}}}\]
      17.0
    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)}}\]
      24.2
    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)}}\]
      24.3
    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}\]
      24.1
    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}}\]
      24.1
    8. Applied simplify to get
      \[e^{\log x.im - \log y.im} \leadsto \frac{x.im}{y.im}\]
      0

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