Average Error: 26.7 → 1.0
Time: 23.5s
Precision: 64
\[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\]
\[\frac{\mathsf{fma}\left(\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, y.re, -\frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right) + \mathsf{fma}\left(-\frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{1}\]
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\frac{\mathsf{fma}\left(\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, y.re, -\frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right) + \mathsf{fma}\left(-\frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{1}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r115611 = x_im;
        double r115612 = y_re;
        double r115613 = r115611 * r115612;
        double r115614 = x_re;
        double r115615 = y_im;
        double r115616 = r115614 * r115615;
        double r115617 = r115613 - r115616;
        double r115618 = r115612 * r115612;
        double r115619 = r115615 * r115615;
        double r115620 = r115618 + r115619;
        double r115621 = r115617 / r115620;
        return r115621;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r115622 = x_im;
        double r115623 = y_re;
        double r115624 = y_im;
        double r115625 = hypot(r115623, r115624);
        double r115626 = r115622 / r115625;
        double r115627 = cbrt(r115624);
        double r115628 = r115627 * r115627;
        double r115629 = cbrt(r115625);
        double r115630 = r115629 * r115629;
        double r115631 = r115628 / r115630;
        double r115632 = x_re;
        double r115633 = r115629 / r115632;
        double r115634 = r115627 / r115633;
        double r115635 = r115631 * r115634;
        double r115636 = -r115635;
        double r115637 = fma(r115626, r115623, r115636);
        double r115638 = -r115634;
        double r115639 = fma(r115638, r115631, r115635);
        double r115640 = r115637 + r115639;
        double r115641 = r115640 / r115625;
        double r115642 = 1.0;
        double r115643 = sqrt(r115642);
        double r115644 = r115641 * r115643;
        return r115644;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 26.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-sqrt26.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-identity26.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-frac26.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. Simplified26.7

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{x.im \cdot y.re - x.re \cdot y.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\]
  7. Simplified17.1

    \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}\]
  8. Using strategy rm
  9. Applied div-sub17.1

    \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \color{blue}{\left(\frac{y.re \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)} - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}\]
  10. Simplified9.7

    \[\leadsto \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\color{blue}{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}}} - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\]
  11. Using strategy rm
  12. Applied *-un-lft-identity9.7

    \[\leadsto \frac{1}{\color{blue}{1 \cdot \mathsf{hypot}\left(y.re, y.im\right)}} \cdot \left(\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\]
  13. Applied add-sqr-sqrt9.7

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{1 \cdot \mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\]
  14. Applied times-frac9.7

    \[\leadsto \color{blue}{\left(\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\mathsf{hypot}\left(y.re, y.im\right)}\right)} \cdot \left(\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\]
  15. Applied associate-*l*9.7

    \[\leadsto \color{blue}{\frac{\sqrt{1}}{1} \cdot \left(\frac{\sqrt{1}}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \left(\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\right)\right)}\]
  16. Simplified1.0

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \color{blue}{\frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{x.re}}}{\mathsf{hypot}\left(y.re, y.im\right)}}\]
  17. Using strategy rm
  18. Applied *-un-lft-identity1.0

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{\color{blue}{1 \cdot x.re}}}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  19. Applied add-cube-cbrt1.5

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im}{\frac{\color{blue}{\left(\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}}{1 \cdot x.re}}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  20. Applied times-frac1.5

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{y.im}{\color{blue}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1} \cdot \frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  21. Applied add-cube-cbrt1.2

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \frac{\color{blue}{\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \sqrt[3]{y.im}}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1} \cdot \frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  22. Applied times-frac0.6

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\frac{x.im}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{y.re}} - \color{blue}{\frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  23. Applied associate-/r/1.0

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\color{blue}{\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot y.re} - \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  24. Applied prod-diff1.0

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, y.re, -\frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}} \cdot \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1}}\right) + \mathsf{fma}\left(-\frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1}}, \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}} \cdot \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1}}\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  25. Simplified1.0

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, y.re, -\frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right)} + \mathsf{fma}\left(-\frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1}}, \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}} \cdot \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{1}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  26. Simplified1.0

    \[\leadsto \frac{\sqrt{1}}{1} \cdot \frac{\mathsf{fma}\left(\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, y.re, -\frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right) + \color{blue}{\mathsf{fma}\left(-\frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\]
  27. Final simplification1.0

    \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}, y.re, -\frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right) + \mathsf{fma}\left(-\frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}, \frac{\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}}{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}} \cdot \frac{\sqrt[3]{y.im}}{\frac{\sqrt[3]{\mathsf{hypot}\left(y.re, y.im\right)}}{x.re}}\right)}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \sqrt{1}\]

Reproduce

herbie shell --seed 2020042 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, imaginary part"
  :precision binary64
  (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))