Average Error: 33.0 → 3.5
Time: 35.1s
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)\]
\[\log \left(e^{\left(\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 \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)}\right) \cdot \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)}}\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\]
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)
\log \left(e^{\left(\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 \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)}\right) \cdot \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)}}\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r692460 = x_re;
        double r692461 = r692460 * r692460;
        double r692462 = x_im;
        double r692463 = r692462 * r692462;
        double r692464 = r692461 + r692463;
        double r692465 = sqrt(r692464);
        double r692466 = log(r692465);
        double r692467 = y_re;
        double r692468 = r692466 * r692467;
        double r692469 = atan2(r692462, r692460);
        double r692470 = y_im;
        double r692471 = r692469 * r692470;
        double r692472 = r692468 - r692471;
        double r692473 = exp(r692472);
        double r692474 = r692466 * r692470;
        double r692475 = r692469 * r692467;
        double r692476 = r692474 + r692475;
        double r692477 = cos(r692476);
        double r692478 = r692473 * r692477;
        return r692478;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r692479 = y_im;
        double r692480 = x_re;
        double r692481 = x_im;
        double r692482 = hypot(r692480, r692481);
        double r692483 = log(r692482);
        double r692484 = y_re;
        double r692485 = atan2(r692481, r692480);
        double r692486 = r692484 * r692485;
        double r692487 = fma(r692479, r692483, r692486);
        double r692488 = cos(r692487);
        double r692489 = cbrt(r692488);
        double r692490 = r692489 * r692489;
        double r692491 = r692490 * r692489;
        double r692492 = exp(r692491);
        double r692493 = log(r692492);
        double r692494 = r692483 * r692484;
        double r692495 = r692479 * r692485;
        double r692496 = r692494 - r692495;
        double r692497 = exp(r692496);
        double r692498 = r692493 * r692497;
        return r692498;
}

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

    \[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}{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-log-exp3.5

    \[\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}{\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)}\]
  5. Using strategy rm
  6. Applied add-cube-cbrt3.5

    \[\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 \log \left(e^{\color{blue}{\left(\sqrt[3]{\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 \sqrt[3]{\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 \sqrt[3]{\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)\]
  7. Final simplification3.5

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

Reproduce

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