Average Error: 33.2 → 11.3
Time: 8.8s
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 1.09120035193117 \cdot 10^{-310}:\\ \;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(e^{-\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}}{{\left(\frac{1}{x.re}\right)}^{y.re}} \cdot 1\\ \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 1.09120035193117 \cdot 10^{-310}:\\
\;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r13160 = x_re;
        double r13161 = r13160 * r13160;
        double r13162 = x_im;
        double r13163 = r13162 * r13162;
        double r13164 = r13161 + r13163;
        double r13165 = sqrt(r13164);
        double r13166 = log(r13165);
        double r13167 = y_re;
        double r13168 = r13166 * r13167;
        double r13169 = atan2(r13162, r13160);
        double r13170 = y_im;
        double r13171 = r13169 * r13170;
        double r13172 = r13168 - r13171;
        double r13173 = exp(r13172);
        double r13174 = r13166 * r13170;
        double r13175 = r13169 * r13167;
        double r13176 = r13174 + r13175;
        double r13177 = cos(r13176);
        double r13178 = r13173 * r13177;
        return r13178;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r13179 = x_re;
        double r13180 = 1.09120035193117e-310;
        bool r13181 = r13179 <= r13180;
        double r13182 = -1.0;
        double r13183 = r13182 * r13179;
        double r13184 = log(r13183);
        double r13185 = y_re;
        double r13186 = r13184 * r13185;
        double r13187 = x_im;
        double r13188 = atan2(r13187, r13179);
        double r13189 = y_im;
        double r13190 = r13188 * r13189;
        double r13191 = r13186 - r13190;
        double r13192 = exp(r13191);
        double r13193 = 1.0;
        double r13194 = r13192 * r13193;
        double r13195 = -r13188;
        double r13196 = exp(r13195);
        double r13197 = pow(r13196, r13189);
        double r13198 = r13193 / r13179;
        double r13199 = pow(r13198, r13185);
        double r13200 = r13197 / r13199;
        double r13201 = r13200 * r13193;
        double r13202 = r13181 ? r13194 : r13201;
        return r13202;
}

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

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

    if 1.09120035193117e-310 < x.re

    1. Initial program 34.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)\]
    2. Taylor expanded around 0 21.4

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

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

      \[\leadsto \color{blue}{\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{1}{x.re}\right)}^{y.re}}} \cdot 1\]
    5. Using strategy rm
    6. Applied distribute-lft-neg-in14.8

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

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

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

Reproduce

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