Average Error: 33.4 → 4.0
Time: 7.2s
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^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\frac{1}{2}} \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\frac{1}{2}}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\]
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^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\frac{1}{2}} \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\frac{1}{2}}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r13938 = x_re;
        double r13939 = r13938 * r13938;
        double r13940 = x_im;
        double r13941 = r13940 * r13940;
        double r13942 = r13939 + r13941;
        double r13943 = sqrt(r13942);
        double r13944 = log(r13943);
        double r13945 = y_re;
        double r13946 = r13944 * r13945;
        double r13947 = atan2(r13940, r13938);
        double r13948 = y_im;
        double r13949 = r13947 * r13948;
        double r13950 = r13946 - r13949;
        double r13951 = exp(r13950);
        double r13952 = r13944 * r13948;
        double r13953 = r13947 * r13945;
        double r13954 = r13952 + r13953;
        double r13955 = cos(r13954);
        double r13956 = r13951 * r13955;
        return r13956;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r13957 = x_re;
        double r13958 = x_im;
        double r13959 = hypot(r13957, r13958);
        double r13960 = 0.5;
        double r13961 = pow(r13959, r13960);
        double r13962 = r13961 * r13961;
        double r13963 = log(r13962);
        double r13964 = y_re;
        double r13965 = r13963 * r13964;
        double r13966 = atan2(r13958, r13957);
        double r13967 = y_im;
        double r13968 = r13966 * r13967;
        double r13969 = r13965 - r13968;
        double r13970 = exp(r13969);
        return r13970;
}

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

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

    \[\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-sqr-sqrt19.6

    \[\leadsto e^{\log \left(\sqrt{\color{blue}{\sqrt{x.re \cdot x.re + x.im \cdot x.im} \cdot \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 1\]
  5. Applied sqrt-prod19.6

    \[\leadsto e^{\log \color{blue}{\left(\sqrt{\sqrt{x.re \cdot x.re + x.im \cdot x.im}} \cdot \sqrt{\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 1\]
  6. Simplified19.6

    \[\leadsto e^{\log \left(\color{blue}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\frac{1}{2}}} \cdot \sqrt{\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 1\]
  7. Simplified4.0

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

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

Reproduce

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