Average Error: 33.3 → 3.9
Time: 7.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)\]
\[e^{\sqrt[3]{{\left(\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)\right)}^{3}}}\]
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)
e^{\sqrt[3]{{\left(\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)\right)}^{3}}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r16363 = x_re;
        double r16364 = r16363 * r16363;
        double r16365 = x_im;
        double r16366 = r16365 * r16365;
        double r16367 = r16364 + r16366;
        double r16368 = sqrt(r16367);
        double r16369 = log(r16368);
        double r16370 = y_re;
        double r16371 = r16369 * r16370;
        double r16372 = atan2(r16365, r16363);
        double r16373 = y_im;
        double r16374 = r16372 * r16373;
        double r16375 = r16371 - r16374;
        double r16376 = exp(r16375);
        double r16377 = r16369 * r16373;
        double r16378 = r16372 * r16370;
        double r16379 = r16377 + r16378;
        double r16380 = cos(r16379);
        double r16381 = r16376 * r16380;
        return r16381;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r16382 = y_re;
        double r16383 = x_re;
        double r16384 = x_im;
        double r16385 = hypot(r16383, r16384);
        double r16386 = log(r16385);
        double r16387 = atan2(r16384, r16383);
        double r16388 = y_im;
        double r16389 = r16387 * r16388;
        double r16390 = -r16389;
        double r16391 = fma(r16382, r16386, r16390);
        double r16392 = 3.0;
        double r16393 = pow(r16391, r16392);
        double r16394 = cbrt(r16393);
        double r16395 = exp(r16394);
        return r16395;
}

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

    \[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. Taylor expanded around 0 19.4

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

    \[\leadsto e^{\color{blue}{\sqrt[3]{\left(\left(\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\right) \cdot \left(\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\right)\right) \cdot \left(\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\right)}}} \cdot 1\]
  5. Simplified3.9

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

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

Reproduce

herbie shell --seed 2019344 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  :precision binary64
  (* (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)))))