Average Error: 25.8 → 23.5
Time: 42.7s
Precision: 64
Internal Precision: 576
\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
\[\begin{array}{l} \mathbf{if}\;y.im \le -1.1259973219141482 \cdot 10^{-75} \lor \neg \left(y.im \le 8.790420369344199 \cdot 10^{-151}\right):\\ \;\;\;\;\frac{x.im \cdot y.re}{y.im \cdot y.im + y.re \cdot y.re} - \frac{\frac{y.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}} \cdot x.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}} \cdot \frac{y.re}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}} - \frac{\frac{y.im \cdot x.re}{\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 < -1.1259973219141482e-75 or 8.790420369344199e-151 < y.im

    1. Initial program 27.1

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt27.1

      \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\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}}}\]
    4. Applied associate-/r*27.1

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    5. Using strategy rm
    6. Applied div-sub27.1

      \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} - \frac{x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    7. Applied div-sub27.1

      \[\leadsto \color{blue}{\frac{\frac{x.im \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}} - \frac{\frac{x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    8. Simplified27.1

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im}} - \frac{\frac{x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity27.1

      \[\leadsto \frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{\frac{x.re \cdot y.im}{\sqrt{\color{blue}{1 \cdot \left(y.re \cdot y.re + y.im \cdot y.im\right)}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    11. Applied sqrt-prod27.1

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

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

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

    if -1.1259973219141482e-75 < y.im < 8.790420369344199e-151

    1. Initial program 22.4

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

      \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\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}}}\]
    4. Applied associate-/r*22.3

      \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    5. Using strategy rm
    6. Applied div-sub22.4

      \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} - \frac{x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    7. Applied div-sub22.4

      \[\leadsto \color{blue}{\frac{\frac{x.im \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}} - \frac{\frac{x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    8. Simplified22.5

      \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im}} - \frac{\frac{x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt22.5

      \[\leadsto \frac{x.im \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}}} - \frac{\frac{x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    11. Applied times-frac19.8

      \[\leadsto \color{blue}{\frac{x.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{y.re}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}} - \frac{\frac{x.re \cdot y.im}{\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 simplification23.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \le -1.1259973219141482 \cdot 10^{-75} \lor \neg \left(y.im \le 8.790420369344199 \cdot 10^{-151}\right):\\ \;\;\;\;\frac{x.im \cdot y.re}{y.im \cdot y.im + y.re \cdot y.re} - \frac{\frac{y.im}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}} \cdot x.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}} \cdot \frac{y.re}{\sqrt{y.im \cdot y.im + y.re \cdot y.re}} - \frac{\frac{y.im \cdot x.re}{\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: 42.7s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes24.323.522.12.137.3%
herbie shell --seed 2018295 
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, imaginary part"
  (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))