\[\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: 6.0 s
Input Error: 26.2
Output Error: 26.4
Log:
Profile: 🕒
\((y.re * x.re + \left(y.im \cdot x.im\right))_* \cdot \frac{1}{(y.im * y.im + \left(y.re \cdot y.re\right))_*}\)
  1. Started with
    \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    26.2
  2. Applied simplify 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{(y.re * x.re + \left(y.im \cdot x.im\right))_*}{(y.im * y.im + \left(y.re \cdot y.re\right))_*}}\]
    26.2
  3. Using strategy rm
    26.2
  4. Applied div-inv to get
    \[\color{red}{\frac{(y.re * x.re + \left(y.im \cdot x.im\right))_*}{(y.im * y.im + \left(y.re \cdot y.re\right))_*}} \leadsto \color{blue}{(y.re * x.re + \left(y.im \cdot x.im\right))_* \cdot \frac{1}{(y.im * y.im + \left(y.re \cdot y.re\right))_*}}\]
    26.4

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