Average Error: 26.0 → 25.8
Time: 48.4s
Precision: 64
Internal Precision: 576
\[\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 -3.229804774568465 \cdot 10^{+115}:\\ \;\;\;\;\frac{-x.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}\\ \mathbf{else}:\\ \;\;\;\;\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}}\\ \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 < -3.229804774568465e+115

    1. Initial program 41.9

      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Initial simplification41.9

      \[\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-sqrt41.9

      \[\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*41.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}}}\]
    6. Using strategy rm
    7. Applied div-inv41.9

      \[\leadsto \frac{\color{blue}{\left(x.im \cdot y.im + x.re \cdot y.re\right) \cdot \frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    8. Taylor expanded around -inf 40.8

      \[\leadsto \frac{\color{blue}{-1 \cdot x.im}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    9. Simplified40.8

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

    if -3.229804774568465e+115 < y.im

    1. Initial program 22.7

      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Initial simplification22.7

      \[\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-sqrt22.7

      \[\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.6

      \[\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}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification25.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \le -3.229804774568465 \cdot 10^{+115}:\\ \;\;\;\;\frac{-x.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}}\\ \mathbf{else}:\\ \;\;\;\;\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}}\\ \end{array}\]

Runtime

Time bar (total: 48.4s)Debug logProfile

herbie shell --seed 2018227 
(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))))