Average Error: 33.4 → 11.7
Time: 29.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)\]
\[\begin{array}{l} \mathbf{if}\;x.re \le -2.084005931921038687306891194857517727513 \cdot 10^{-310}:\\ \;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x.re}^{\left(\frac{y.re}{2}\right)}}{\frac{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}}{{x.re}^{\left(\frac{y.re}{2}\right)}}}\\ \end{array}\]
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)
\begin{array}{l}
\mathbf{if}\;x.re \le -2.084005931921038687306891194857517727513 \cdot 10^{-310}:\\
\;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{else}:\\
\;\;\;\;\frac{{x.re}^{\left(\frac{y.re}{2}\right)}}{\frac{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}}{{x.re}^{\left(\frac{y.re}{2}\right)}}}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r20528 = x_re;
        double r20529 = r20528 * r20528;
        double r20530 = x_im;
        double r20531 = r20530 * r20530;
        double r20532 = r20529 + r20531;
        double r20533 = sqrt(r20532);
        double r20534 = log(r20533);
        double r20535 = y_re;
        double r20536 = r20534 * r20535;
        double r20537 = atan2(r20530, r20528);
        double r20538 = y_im;
        double r20539 = r20537 * r20538;
        double r20540 = r20536 - r20539;
        double r20541 = exp(r20540);
        double r20542 = r20534 * r20538;
        double r20543 = r20537 * r20535;
        double r20544 = r20542 + r20543;
        double r20545 = cos(r20544);
        double r20546 = r20541 * r20545;
        return r20546;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r20547 = x_re;
        double r20548 = -2.08400593192104e-310;
        bool r20549 = r20547 <= r20548;
        double r20550 = y_re;
        double r20551 = -1.0;
        double r20552 = r20551 / r20547;
        double r20553 = log(r20552);
        double r20554 = r20550 * r20553;
        double r20555 = -r20554;
        double r20556 = x_im;
        double r20557 = atan2(r20556, r20547);
        double r20558 = y_im;
        double r20559 = r20557 * r20558;
        double r20560 = r20555 - r20559;
        double r20561 = exp(r20560);
        double r20562 = 2.0;
        double r20563 = r20550 / r20562;
        double r20564 = pow(r20547, r20563);
        double r20565 = exp(r20557);
        double r20566 = pow(r20565, r20558);
        double r20567 = r20566 / r20564;
        double r20568 = r20564 / r20567;
        double r20569 = r20549 ? r20561 : r20568;
        return r20569;
}

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. Split input into 2 regimes
  2. if x.re < -2.08400593192104e-310

    1. Initial program 31.9

      \[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 17.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. Taylor expanded around -inf 6.0

      \[\leadsto e^{\color{blue}{-1 \cdot \left(y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    4. Simplified6.0

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

    if -2.08400593192104e-310 < x.re

    1. Initial program 34.9

      \[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 22.0

      \[\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. Taylor expanded around inf 12.0

      \[\leadsto \color{blue}{e^{-\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{1}{x.re}\right)\right)}} \cdot 1\]
    4. Simplified15.4

      \[\leadsto \color{blue}{\frac{{x.re}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot 1\]
    5. Using strategy rm
    6. Applied sqr-pow15.4

      \[\leadsto \frac{\color{blue}{{x.re}^{\left(\frac{y.re}{2}\right)} \cdot {x.re}^{\left(\frac{y.re}{2}\right)}}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot 1\]
    7. Applied associate-/l*15.4

      \[\leadsto \color{blue}{\frac{{x.re}^{\left(\frac{y.re}{2}\right)}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{x.re}^{\left(\frac{y.re}{2}\right)}}}} \cdot 1\]
    8. Simplified17.1

      \[\leadsto \frac{{x.re}^{\left(\frac{y.re}{2}\right)}}{\color{blue}{\frac{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}}{{x.re}^{\left(\frac{y.re}{2}\right)}}}} \cdot 1\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -2.084005931921038687306891194857517727513 \cdot 10^{-310}:\\ \;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x.re}^{\left(\frac{y.re}{2}\right)}}{\frac{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}}{{x.re}^{\left(\frac{y.re}{2}\right)}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019325 
(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)))))