Average Error: 33.2 → 4.0
Time: 8.7s
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({\left(e^{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}\right)}^{\left(e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.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)
\log \left({\left(e^{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}\right)}^{\left(e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right)}\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r14833 = x_re;
        double r14834 = r14833 * r14833;
        double r14835 = x_im;
        double r14836 = r14835 * r14835;
        double r14837 = r14834 + r14836;
        double r14838 = sqrt(r14837);
        double r14839 = log(r14838);
        double r14840 = y_re;
        double r14841 = r14839 * r14840;
        double r14842 = atan2(r14835, r14833);
        double r14843 = y_im;
        double r14844 = r14842 * r14843;
        double r14845 = r14841 - r14844;
        double r14846 = exp(r14845);
        double r14847 = r14839 * r14843;
        double r14848 = r14842 * r14840;
        double r14849 = r14847 + r14848;
        double r14850 = cos(r14849);
        double r14851 = r14846 * r14850;
        return r14851;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14852 = x_re;
        double r14853 = x_im;
        double r14854 = hypot(r14852, r14853);
        double r14855 = y_re;
        double r14856 = pow(r14854, r14855);
        double r14857 = exp(r14856);
        double r14858 = atan2(r14853, r14852);
        double r14859 = y_im;
        double r14860 = r14858 * r14859;
        double r14861 = -r14860;
        double r14862 = exp(r14861);
        double r14863 = pow(r14857, r14862);
        double r14864 = log(r14863);
        return r14864;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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 19.5

    \[\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-log-exp19.6

    \[\leadsto \color{blue}{\log \left(e^{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}}\right)} \cdot 1\]
  5. Simplified4.0

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

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

Reproduce

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