\[\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: 10.8 s
Input Error: 13.9
Output Error: 2.3
Log:
Profile: 🕒
\(\begin{cases} \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} + \frac{x.re}{y.re} & \text{when } y.re \le -6.643754f+11 \\ \frac{x.re \cdot y.re + x.im \cdot y.im}{{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}^2} & \text{when } y.re \le -6.138259f-23 \\ \frac{y.re}{y.im} \cdot \frac{x.re}{y.im} + \frac{x.im}{y.im} & \text{when } y.re \le 0.009737393f0 \\ \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} + \frac{x.re}{y.re} & \text{otherwise} \end{cases}\)

    if y.re < -6.643754f+11 or 0.009737393f0 < 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}\]
      18.4
    2. Using strategy rm
      18.4
    3. Applied add-sqr-sqrt 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{y.re \cdot y.re + y.im \cdot y.im}\right)}^2}}\]
      18.4
    4. Applied simplify to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}}^2}\]
      18.4
    5. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{y.re}^2}\]
      15.5
    6. Taylor expanded around inf to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{y.re}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{y.re}}^2}\]
      15.5
    7. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{y.re}^2} \leadsto \frac{y.im \cdot x.im}{{y.re}^2} + \frac{x.re}{y.re}\]
      5.2
    8. Taylor expanded around 0 to get
      \[\color{red}{\frac{y.im \cdot x.im}{{y.re}^2} + \frac{x.re}{y.re}} \leadsto \color{blue}{\frac{y.im \cdot x.im}{{y.re}^2} + \frac{x.re}{y.re}}\]
      5.2
    9. Applied simplify to get
      \[\frac{y.im \cdot x.im}{{y.re}^2} + \frac{x.re}{y.re} \leadsto \frac{y.im}{y.re} \cdot \frac{x.im}{y.re} + \frac{x.re}{y.re}\]
      0.4

    10. Applied final simplification

    if -6.643754f+11 < y.re < -6.138259f-23

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

    if -6.138259f-23 < y.re < 0.009737393f0

    1. Started with
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
      11.4
    2. Using strategy rm
      11.4
    3. Applied add-sqr-sqrt 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{y.re \cdot y.re + y.im \cdot y.im}\right)}^2}}\]
      11.3
    4. Applied simplify to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{\left(\sqrt{y.re \cdot y.re + y.im \cdot y.im}\right)}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}}^2}\]
      11.3
    5. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\left(\sqrt{{y.re}^2 + y.im \cdot y.im}\right)}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{y.im}^2}\]
      10.5
    6. Taylor expanded around 0 to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{red}{y.im}}^2} \leadsto \frac{x.re \cdot y.re + x.im \cdot y.im}{{\color{blue}{y.im}}^2}\]
      10.5
    7. Applied taylor to get
      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{{y.im}^2} \leadsto \frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im}\]
      3.2
    8. Taylor expanded around 0 to get
      \[\color{red}{\frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im}} \leadsto \color{blue}{\frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im}}\]
      3.2
    9. Applied simplify to get
      \[\frac{y.re \cdot x.re}{{y.im}^2} + \frac{x.im}{y.im} \leadsto \frac{y.re}{y.im} \cdot \frac{x.re}{y.im} + \frac{x.im}{y.im}\]
      1.2

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