Average Error: 32.9 → 3.5
Time: 31.0s
Precision: 64
\[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
\[e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(y.im \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)\right)\right)} \cdot \log \left(e^{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}\right)\]
e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(y.im \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)\right)\right)} \cdot \log \left(e^{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1268595 = x_re;
        double r1268596 = r1268595 * r1268595;
        double r1268597 = x_im;
        double r1268598 = r1268597 * r1268597;
        double r1268599 = r1268596 + r1268598;
        double r1268600 = sqrt(r1268599);
        double r1268601 = log(r1268600);
        double r1268602 = y_re;
        double r1268603 = r1268601 * r1268602;
        double r1268604 = atan2(r1268597, r1268595);
        double r1268605 = y_im;
        double r1268606 = r1268604 * r1268605;
        double r1268607 = r1268603 - r1268606;
        double r1268608 = exp(r1268607);
        double r1268609 = r1268601 * r1268605;
        double r1268610 = r1268604 * r1268602;
        double r1268611 = r1268609 + r1268610;
        double r1268612 = cos(r1268611);
        double r1268613 = r1268608 * r1268612;
        return r1268613;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1268614 = y_re;
        double r1268615 = x_re;
        double r1268616 = x_im;
        double r1268617 = hypot(r1268615, r1268616);
        double r1268618 = log(r1268617);
        double r1268619 = r1268614 * r1268618;
        double r1268620 = atan2(r1268616, r1268615);
        double r1268621 = cbrt(r1268620);
        double r1268622 = r1268621 * r1268621;
        double r1268623 = y_im;
        double r1268624 = cbrt(r1268621);
        double r1268625 = r1268624 * r1268624;
        double r1268626 = r1268624 * r1268625;
        double r1268627 = r1268623 * r1268626;
        double r1268628 = r1268622 * r1268627;
        double r1268629 = r1268619 - r1268628;
        double r1268630 = exp(r1268629);
        double r1268631 = r1268620 * r1268614;
        double r1268632 = fma(r1268623, r1268618, r1268631);
        double r1268633 = cos(r1268632);
        double r1268634 = exp(r1268633);
        double r1268635 = log(r1268634);
        double r1268636 = r1268630 * r1268635;
        return r1268636;
}

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 32.9

    \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
  2. Simplified3.5

    \[\leadsto \color{blue}{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt3.5

    \[\leadsto \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \color{blue}{\left(\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right)} \cdot y.im}\]
  5. Applied associate-*l*3.5

    \[\leadsto \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \color{blue}{\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.im\right)}}\]
  6. Using strategy rm
  7. Applied add-cube-cbrt3.5

    \[\leadsto \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(\color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)} \cdot y.im\right)}\]
  8. Using strategy rm
  9. Applied add-log-exp3.5

    \[\leadsto \color{blue}{\log \left(e^{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}\right)} \cdot e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot y.im\right)}\]
  10. Final simplification3.5

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(y.im \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)\right)\right)} \cdot \log \left(e^{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}\right)\]

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))