Average Error: 25.7 → 1.4
Time: 41.8s
Precision: 64
Internal Precision: 384
\[\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 -4.426662094485314 \cdot 10^{-226}:\\ \;\;\;\;\frac{\frac{y.re}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{x.im}} + \frac{\frac{-x.re}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{y.im}}\\ \mathbf{if}\;y.im \le 9.332805945311764 \cdot 10^{-40}:\\ \;\;\;\;\frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \left(\frac{y.re}{1} \cdot \frac{x.im}{\sqrt{y.re^2 + y.im^2}^*} - \frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y.re}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{x.im}} + \frac{\frac{-x.re}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{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

Derivation

  1. Split input into 2 regimes
  2. if y.im < -4.426662094485314e-226 or 9.332805945311764e-40 < y.im

    1. Initial program 27.9

      \[\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-sqrt28.0

      \[\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 *-un-lft-identity28.0

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{\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 times-frac28.0

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}\]
    6. Applied simplify28.0

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    7. Applied simplify18.5

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
    8. Using strategy rm
    9. Applied div-sub18.5

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(\frac{y.re \cdot x.im}{\sqrt{y.re^2 + y.im^2}^*} - \frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)}\]
    10. Using strategy rm
    11. Applied sub-neg18.5

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(\frac{y.re \cdot x.im}{\sqrt{y.re^2 + y.im^2}^*} + \left(-\frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)\right)}\]
    12. Applied distribute-rgt-in18.5

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im}{\sqrt{y.re^2 + y.im^2}^*} \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*} + \left(-\frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}}\]
    13. Applied simplify12.3

      \[\leadsto \color{blue}{\frac{\frac{y.re}{\sqrt{y.re^2 + y.im^2}^*}}{\frac{\sqrt{y.re^2 + y.im^2}^*}{x.im}}} + \left(-\frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right) \cdot \frac{1}{\sqrt{y.re^2 + y.im^2}^*}\]
    14. Applied simplify1.1

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

    if -4.426662094485314e-226 < y.im < 9.332805945311764e-40

    1. Initial program 19.7

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

      \[\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 *-un-lft-identity19.7

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x.im \cdot y.re - x.re \cdot y.im\right)}}{\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 times-frac19.7

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt{y.re^2 + y.im^2}^*}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
    7. Applied simplify11.7

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\frac{y.re \cdot x.im - x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}}\]
    8. Using strategy rm
    9. Applied div-sub11.7

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \color{blue}{\left(\frac{y.re \cdot x.im}{\sqrt{y.re^2 + y.im^2}^*} - \frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity11.7

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \left(\frac{y.re \cdot x.im}{\color{blue}{1 \cdot \sqrt{y.re^2 + y.im^2}^*}} - \frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)\]
    12. Applied times-frac2.4

      \[\leadsto \frac{1}{\sqrt{y.re^2 + y.im^2}^*} \cdot \left(\color{blue}{\frac{y.re}{1} \cdot \frac{x.im}{\sqrt{y.re^2 + y.im^2}^*}} - \frac{x.re \cdot y.im}{\sqrt{y.re^2 + y.im^2}^*}\right)\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 41.8s)Debug logProfile

herbie shell --seed '#(1064173506 2580572819 2847706409 4129882574 1125180799 1845288547)' +o rules:numerics
(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))))