Average Error: 25.7 → 25.8
Time: 19.7s
Precision: 64
Internal Precision: 128
\[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
\[\begin{array}{l} \mathbf{if}\;y.im \le 2.8212550774050387 \cdot 10^{+61}:\\ \;\;\;\;\frac{\frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}\\ \end{array}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if y.im < 2.8212550774050387e+61

    1. Initial program 23.0

      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Initial simplification23.0

      \[\leadsto \frac{x.im \cdot y.im + x.re \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt23.0

      \[\leadsto \frac{x.im \cdot y.im + x.re \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    5. Applied associate-/r*22.9

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.im + x.re \cdot y.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]

    if 2.8212550774050387e+61 < y.im

    1. Initial program 35.5

      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Initial simplification35.5

      \[\leadsto \frac{x.im \cdot y.im + x.re \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt35.5

      \[\leadsto \frac{x.im \cdot y.im + x.re \cdot y.re}{\color{blue}{\sqrt{y.re \cdot y.re + y.im \cdot y.im} \cdot \sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    5. Applied associate-/r*35.5

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.im + x.re \cdot y.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Taylor expanded around inf 36.6

      \[\leadsto \frac{\color{blue}{x.im}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification25.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \le 2.8212550774050387 \cdot 10^{+61}:\\ \;\;\;\;\frac{\frac{x.re \cdot y.re + x.im \cdot y.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}\\ \end{array}\]

Runtime

Time bar (total: 19.7s)Debug logProfile

herbie shell --seed 2018277 
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, real part"
  (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))