Average Error: 32.6 → 4.0
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]{\mathsf{log1p}\left(\mathsf{expm1}\left({\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}\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)
e^{\sqrt[3]{\mathsf{log1p}\left(\mathsf{expm1}\left({\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}\right)\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r18414 = x_re;
        double r18415 = r18414 * r18414;
        double r18416 = x_im;
        double r18417 = r18416 * r18416;
        double r18418 = r18415 + r18417;
        double r18419 = sqrt(r18418);
        double r18420 = log(r18419);
        double r18421 = y_re;
        double r18422 = r18420 * r18421;
        double r18423 = atan2(r18416, r18414);
        double r18424 = y_im;
        double r18425 = r18423 * r18424;
        double r18426 = r18422 - r18425;
        double r18427 = exp(r18426);
        double r18428 = r18420 * r18424;
        double r18429 = r18423 * r18421;
        double r18430 = r18428 + r18429;
        double r18431 = cos(r18430);
        double r18432 = r18427 * r18431;
        return r18432;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r18433 = y_re;
        double r18434 = x_re;
        double r18435 = x_im;
        double r18436 = hypot(r18434, r18435);
        double r18437 = log(r18436);
        double r18438 = atan2(r18435, r18434);
        double r18439 = y_im;
        double r18440 = r18438 * r18439;
        double r18441 = -r18440;
        double r18442 = fma(r18433, r18437, r18441);
        double r18443 = 3.0;
        double r18444 = pow(r18442, r18443);
        double r18445 = expm1(r18444);
        double r18446 = log1p(r18445);
        double r18447 = cbrt(r18446);
        double r18448 = exp(r18447);
        return r18448;
}

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. Taylor expanded around 0 19.2

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

    \[\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. Using strategy rm
  7. Applied log1p-expm1-u4.0

    \[\leadsto e^{\sqrt[3]{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\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}\right)\right)}}} \cdot 1\]
  8. Final simplification4.0

    \[\leadsto e^{\sqrt[3]{\mathsf{log1p}\left(\mathsf{expm1}\left({\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}\right)\right)}}\]

Reproduce

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