Average Error: 33.1 → 4.4
Time: 6.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({\left(\mathsf{log1p}\left(\mathsf{expm1}\left(e^{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}\right)\right)\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(\mathsf{log1p}\left(\mathsf{expm1}\left(e^{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}\right)\right)\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 r16952 = x_re;
        double r16953 = r16952 * r16952;
        double r16954 = x_im;
        double r16955 = r16954 * r16954;
        double r16956 = r16953 + r16955;
        double r16957 = sqrt(r16956);
        double r16958 = log(r16957);
        double r16959 = y_re;
        double r16960 = r16958 * r16959;
        double r16961 = atan2(r16954, r16952);
        double r16962 = y_im;
        double r16963 = r16961 * r16962;
        double r16964 = r16960 - r16963;
        double r16965 = exp(r16964);
        double r16966 = r16958 * r16962;
        double r16967 = r16961 * r16959;
        double r16968 = r16966 + r16967;
        double r16969 = cos(r16968);
        double r16970 = r16965 * r16969;
        return r16970;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r16971 = x_re;
        double r16972 = x_im;
        double r16973 = hypot(r16971, r16972);
        double r16974 = y_re;
        double r16975 = pow(r16973, r16974);
        double r16976 = exp(r16975);
        double r16977 = expm1(r16976);
        double r16978 = log1p(r16977);
        double r16979 = atan2(r16972, r16971);
        double r16980 = y_im;
        double r16981 = r16979 * r16980;
        double r16982 = -r16981;
        double r16983 = exp(r16982);
        double r16984 = pow(r16978, r16983);
        double r16985 = log(r16984);
        return r16985;
}

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

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

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

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

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

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

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

Reproduce

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