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

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r20449 = x_re;
        double r20450 = r20449 * r20449;
        double r20451 = x_im;
        double r20452 = r20451 * r20451;
        double r20453 = r20450 + r20452;
        double r20454 = sqrt(r20453);
        double r20455 = log(r20454);
        double r20456 = y_re;
        double r20457 = r20455 * r20456;
        double r20458 = atan2(r20451, r20449);
        double r20459 = y_im;
        double r20460 = r20458 * r20459;
        double r20461 = r20457 - r20460;
        double r20462 = exp(r20461);
        double r20463 = r20455 * r20459;
        double r20464 = r20458 * r20456;
        double r20465 = r20463 + r20464;
        double r20466 = cos(r20465);
        double r20467 = r20462 * r20466;
        return r20467;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r20468 = x_re;
        double r20469 = -2.08400593192104e-310;
        bool r20470 = r20468 <= r20469;
        double r20471 = -r20468;
        double r20472 = log(r20471);
        double r20473 = y_re;
        double r20474 = r20472 * r20473;
        double r20475 = x_im;
        double r20476 = atan2(r20475, r20468);
        double r20477 = y_im;
        double r20478 = r20476 * r20477;
        double r20479 = r20474 - r20478;
        double r20480 = exp(r20479);
        double r20481 = pow(r20468, r20473);
        double r20482 = exp(r20476);
        double r20483 = pow(r20482, r20477);
        double r20484 = log(r20483);
        double r20485 = exp(r20484);
        double r20486 = r20481 / r20485;
        double r20487 = r20470 ? r20480 : r20486;
        return r20487;
}

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^{\log \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    4. Simplified6.0

      \[\leadsto e^{\log \color{blue}{\left(-x.re\right)} \cdot y.re - \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 add-log-exp15.4

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

      \[\leadsto \frac{{x.re}^{y.re}}{e^{\log \color{blue}{\left({\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}\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^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x.re}^{y.re}}{e^{\log \left({\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}\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)))))