Average Error: 33.2 → 4.0
Time: 8.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)\]
\[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 r18788 = x_re;
        double r18789 = r18788 * r18788;
        double r18790 = x_im;
        double r18791 = r18790 * r18790;
        double r18792 = r18789 + r18791;
        double r18793 = sqrt(r18792);
        double r18794 = log(r18793);
        double r18795 = y_re;
        double r18796 = r18794 * r18795;
        double r18797 = atan2(r18790, r18788);
        double r18798 = y_im;
        double r18799 = r18797 * r18798;
        double r18800 = r18796 - r18799;
        double r18801 = exp(r18800);
        double r18802 = r18794 * r18798;
        double r18803 = r18797 * r18795;
        double r18804 = r18802 + r18803;
        double r18805 = cos(r18804);
        double r18806 = r18801 * r18805;
        return r18806;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r18807 = y_re;
        double r18808 = x_re;
        double r18809 = x_im;
        double r18810 = hypot(r18808, r18809);
        double r18811 = log(r18810);
        double r18812 = atan2(r18809, r18808);
        double r18813 = y_im;
        double r18814 = r18812 * r18813;
        double r18815 = -r18814;
        double r18816 = fma(r18807, r18811, r18815);
        double r18817 = 3.0;
        double r18818 = pow(r18816, r18817);
        double r18819 = cbrt(r18818);
        double r18820 = exp(r18819);
        return r18820;
}

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.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. Taylor expanded around 0 20.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-cube20.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. Simplified4.0

    \[\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 simplification4.0

    \[\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 2019362 +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)))))