Average Error: 26.3 → 26.1
Time: 28.5s
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.re \le -1.507317256257123 \cdot 10^{+121}:\\ \;\;\;\;\frac{-x.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}{x.im \cdot y.im + x.re \cdot y.re}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\ \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.re < -1.507317256257123e+121

    1. Initial program 41.2

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

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

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

      \[\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 clear-num41.2

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

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

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

    if -1.507317256257123e+121 < y.re

    1. Initial program 23.5

      \[\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Initial simplification23.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-sqrt23.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*23.4

      \[\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 clear-num23.5

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

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

Runtime

Time bar (total: 28.5s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes26.326.122.73.66%
herbie shell --seed 2018339 
(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))))