Average Error: 32.6 → 3.3
Time: 36.6s
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)\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\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)\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\right)}\right) \cdot \sqrt[3]{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)
\mathsf{log1p}\left(\mathsf{expm1}\left(\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)\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\right)}\right) \cdot \sqrt[3]{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 r1083365 = x_re;
        double r1083366 = r1083365 * r1083365;
        double r1083367 = x_im;
        double r1083368 = r1083367 * r1083367;
        double r1083369 = r1083366 + r1083368;
        double r1083370 = sqrt(r1083369);
        double r1083371 = log(r1083370);
        double r1083372 = y_re;
        double r1083373 = r1083371 * r1083372;
        double r1083374 = atan2(r1083367, r1083365);
        double r1083375 = y_im;
        double r1083376 = r1083374 * r1083375;
        double r1083377 = r1083373 - r1083376;
        double r1083378 = exp(r1083377);
        double r1083379 = r1083371 * r1083375;
        double r1083380 = r1083374 * r1083372;
        double r1083381 = r1083379 + r1083380;
        double r1083382 = cos(r1083381);
        double r1083383 = r1083378 * r1083382;
        return r1083383;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1083384 = y_im;
        double r1083385 = x_re;
        double r1083386 = x_im;
        double r1083387 = hypot(r1083385, r1083386);
        double r1083388 = log(r1083387);
        double r1083389 = y_re;
        double r1083390 = atan2(r1083386, r1083385);
        double r1083391 = r1083389 * r1083390;
        double r1083392 = fma(r1083384, r1083388, r1083391);
        double r1083393 = cos(r1083392);
        double r1083394 = expm1(r1083393);
        double r1083395 = log1p(r1083394);
        double r1083396 = r1083388 * r1083389;
        double r1083397 = r1083384 * r1083390;
        double r1083398 = cbrt(r1083397);
        double r1083399 = cbrt(r1083398);
        double r1083400 = r1083399 * r1083399;
        double r1083401 = r1083399 * r1083400;
        double r1083402 = cbrt(r1083401);
        double r1083403 = r1083400 * r1083402;
        double r1083404 = r1083403 * r1083398;
        double r1083405 = r1083398 * r1083404;
        double r1083406 = r1083396 - r1083405;
        double r1083407 = exp(r1083406);
        double r1083408 = r1083395 * r1083407;
        return r1083408;
}

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

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

    \[\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-cube-cbrt3.3

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

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

    \[\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 y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\color{blue}{\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}\right)\right) \cdot \sqrt[3]{\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)\]
  9. Using strategy rm
  10. Applied log1p-expm1-u3.3

    \[\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 y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\right)\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\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)\right)\right)}\]
  11. Final simplification3.3

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

Reproduce

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