Average Error: 32.2 → 3.2
Time: 30.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)\]
\[\frac{\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \sqrt[3]{y.re}\right)\right)} \cdot \sqrt[3]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \sqrt[3]{y.re}\right)\right)}\right) \cdot \sqrt[3]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \sqrt[3]{y.re}\right)\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\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)
\frac{\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \sqrt[3]{y.re}\right)\right)} \cdot \sqrt[3]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \sqrt[3]{y.re}\right)\right)}\right) \cdot \sqrt[3]{\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \sqrt[3]{y.re}\right)\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1285405 = x_re;
        double r1285406 = r1285405 * r1285405;
        double r1285407 = x_im;
        double r1285408 = r1285407 * r1285407;
        double r1285409 = r1285406 + r1285408;
        double r1285410 = sqrt(r1285409);
        double r1285411 = log(r1285410);
        double r1285412 = y_re;
        double r1285413 = r1285411 * r1285412;
        double r1285414 = atan2(r1285407, r1285405);
        double r1285415 = y_im;
        double r1285416 = r1285414 * r1285415;
        double r1285417 = r1285413 - r1285416;
        double r1285418 = exp(r1285417);
        double r1285419 = r1285411 * r1285415;
        double r1285420 = r1285414 * r1285412;
        double r1285421 = r1285419 + r1285420;
        double r1285422 = cos(r1285421);
        double r1285423 = r1285418 * r1285422;
        return r1285423;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1285424 = y_im;
        double r1285425 = x_re;
        double r1285426 = x_im;
        double r1285427 = hypot(r1285425, r1285426);
        double r1285428 = log(r1285427);
        double r1285429 = y_re;
        double r1285430 = cbrt(r1285429);
        double r1285431 = r1285430 * r1285430;
        double r1285432 = atan2(r1285426, r1285425);
        double r1285433 = r1285431 * r1285432;
        double r1285434 = r1285433 * r1285430;
        double r1285435 = fma(r1285424, r1285428, r1285434);
        double r1285436 = cos(r1285435);
        double r1285437 = cbrt(r1285436);
        double r1285438 = r1285437 * r1285437;
        double r1285439 = r1285438 * r1285437;
        double r1285440 = r1285432 * r1285424;
        double r1285441 = r1285429 * r1285428;
        double r1285442 = r1285440 - r1285441;
        double r1285443 = exp(r1285442);
        double r1285444 = r1285439 / r1285443;
        return r1285444;
}

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

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

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

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

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

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

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

Reproduce

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