Average Error: 33.4 → 3.4
Time: 25.8s
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)\]
\[\sqrt[3]{{\left(\log \left(e^{\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}\right)\right)}^{3}} \cdot e^{\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\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)
\sqrt[3]{{\left(\log \left(e^{\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}\right)\right)}^{3}} \cdot e^{\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r25601 = x_re;
        double r25602 = r25601 * r25601;
        double r25603 = x_im;
        double r25604 = r25603 * r25603;
        double r25605 = r25602 + r25604;
        double r25606 = sqrt(r25605);
        double r25607 = log(r25606);
        double r25608 = y_re;
        double r25609 = r25607 * r25608;
        double r25610 = atan2(r25603, r25601);
        double r25611 = y_im;
        double r25612 = r25610 * r25611;
        double r25613 = r25609 - r25612;
        double r25614 = exp(r25613);
        double r25615 = r25607 * r25611;
        double r25616 = r25610 * r25608;
        double r25617 = r25615 + r25616;
        double r25618 = cos(r25617);
        double r25619 = r25614 * r25618;
        return r25619;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r25620 = x_re;
        double r25621 = x_im;
        double r25622 = hypot(r25620, r25621);
        double r25623 = log(r25622);
        double r25624 = y_im;
        double r25625 = atan2(r25621, r25620);
        double r25626 = y_re;
        double r25627 = r25625 * r25626;
        double r25628 = fma(r25623, r25624, r25627);
        double r25629 = cos(r25628);
        double r25630 = exp(r25629);
        double r25631 = log(r25630);
        double r25632 = 3.0;
        double r25633 = pow(r25631, r25632);
        double r25634 = cbrt(r25633);
        double r25635 = r25624 * r25625;
        double r25636 = -r25635;
        double r25637 = fma(r25626, r25623, r25636);
        double r25638 = exp(r25637);
        double r25639 = r25634 * r25638;
        return r25639;
}

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 33.4

    \[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. Simplified8.8

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

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

    \[\leadsto \cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot \frac{\color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re}}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\]
  6. Applied div-exp3.4

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019195 +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)))))