Average Error: 33.7 → 3.6
Time: 26.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]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \left(\log \left(e^{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\right) \cdot \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)} \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\sqrt[3]{\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\sqrt[3]{\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \cdot \sqrt[3]{y.im}}\]
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]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \left(\log \left(e^{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\right) \cdot \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)} \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\sqrt[3]{\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\sqrt[3]{\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\right) \cdot \sqrt[3]{y.im}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1203217 = x_re;
        double r1203218 = r1203217 * r1203217;
        double r1203219 = x_im;
        double r1203220 = r1203219 * r1203219;
        double r1203221 = r1203218 + r1203220;
        double r1203222 = sqrt(r1203221);
        double r1203223 = log(r1203222);
        double r1203224 = y_re;
        double r1203225 = r1203223 * r1203224;
        double r1203226 = atan2(r1203219, r1203217);
        double r1203227 = y_im;
        double r1203228 = r1203226 * r1203227;
        double r1203229 = r1203225 - r1203228;
        double r1203230 = exp(r1203229);
        double r1203231 = r1203223 * r1203227;
        double r1203232 = r1203226 * r1203224;
        double r1203233 = r1203231 + r1203232;
        double r1203234 = cos(r1203233);
        double r1203235 = r1203230 * r1203234;
        return r1203235;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1203236 = y_im;
        double r1203237 = x_re;
        double r1203238 = x_im;
        double r1203239 = hypot(r1203237, r1203238);
        double r1203240 = log(r1203239);
        double r1203241 = y_re;
        double r1203242 = atan2(r1203238, r1203237);
        double r1203243 = r1203241 * r1203242;
        double r1203244 = fma(r1203236, r1203240, r1203243);
        double r1203245 = cos(r1203244);
        double r1203246 = exp(r1203245);
        double r1203247 = log(r1203246);
        double r1203248 = r1203247 * r1203245;
        double r1203249 = r1203245 * r1203248;
        double r1203250 = cbrt(r1203249);
        double r1203251 = r1203240 * r1203241;
        double r1203252 = cbrt(r1203236);
        double r1203253 = r1203252 * r1203252;
        double r1203254 = r1203253 * r1203242;
        double r1203255 = cbrt(r1203254);
        double r1203256 = r1203255 * r1203255;
        double r1203257 = r1203255 * r1203256;
        double r1203258 = r1203257 * r1203252;
        double r1203259 = r1203251 - r1203258;
        double r1203260 = exp(r1203259);
        double r1203261 = r1203250 * r1203260;
        return r1203261;
}

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.7

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

    \[\leadsto \color{blue}{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} \cdot \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)}\]
  3. Using strategy rm
  4. Applied add-cbrt-cube3.6

    \[\leadsto 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} \cdot \color{blue}{\sqrt[3]{\left(\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 \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 \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)}}\]
  5. Using strategy rm
  6. Applied add-cube-cbrt3.6

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot \color{blue}{\left(\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \sqrt[3]{y.im}\right)}} \cdot \sqrt[3]{\left(\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 \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 \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)}\]
  7. Applied associate-*r*3.6

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)\right) \cdot \sqrt[3]{y.im}}} \cdot \sqrt[3]{\left(\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 \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 \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)}\]
  8. Using strategy rm
  9. Applied add-cube-cbrt3.6

    \[\leadsto 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 \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)}\right)} \cdot \sqrt[3]{y.im}} \cdot \sqrt[3]{\left(\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 \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 \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)}\]
  10. Using strategy rm
  11. Applied add-log-exp3.6

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)}\right) \cdot \sqrt[3]{y.im}} \cdot \sqrt[3]{\left(\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 \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)}\right) \cdot \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)}\]
  12. Final simplification3.6

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

Reproduce

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