\[\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: 14.9 s
Input Error: 14.1
Output Error: 3.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 -33115598.0f0 \\ \frac{1}{\frac{1}{\frac{y.re \cdot x.re + x.im \cdot y.im}{{y.re}^2 + y.im \cdot y.im}}} & \text{when } y.re \le -2.1936735f-25 \\ \frac{x.im}{y.im} & \text{when } y.re \le 1.0985469f-16 \\ \frac{1}{\frac{1}{\frac{y.re \cdot x.re + x.im \cdot y.im}{{y.re}^2 + y.im \cdot y.im}}} & \text{when } y.re \le 3.1540074f+08 \\ \frac{x.re}{y.re} + \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} & \text{otherwise} \end{cases}\)

    if y.re < -33115598.0f0 or 3.1540074f+08 < 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}\]
      19.1
    2. Using strategy rm
      19.1
    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}}\]
      19.2
    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}\]
      19.2
    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.2
    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.2
    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.4

    8. Applied final simplification

    if -33115598.0f0 < y.re < -2.1936735f-25 or 1.0985469f-16 < y.re < 3.1540074f+08

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      7.7
    2. Using strategy rm
      7.7
    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}}}\]
      7.9
    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}}}\]
      7.9
    5. Using strategy rm
      7.9
    6. Applied clear-num to get
      \[\frac{1}{\color{red}{\frac{{y.re}^2 + y.im \cdot y.im}{y.re \cdot x.re + x.im \cdot y.im}}} \leadsto \frac{1}{\color{blue}{\frac{1}{\frac{y.re \cdot x.re + x.im \cdot y.im}{{y.re}^2 + y.im \cdot y.im}}}}\]
      7.9

    if -2.1936735f-25 < y.re < 1.0985469f-16

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      15.5
    2. Using strategy rm
      15.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)}}}\]
      16.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)}}\]
      23.5
    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)}}\]
      23.6
    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}\]
      23.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}}\]
      23.9
    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))))