Average Error: 33.7 → 9.1
Time: 25.4s
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 -3.160936571024873549917158514294633017572 \cdot 10^{-255}:\\ \;\;\;\;e^{\sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \log \left(-x.re\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le -7.586608897104559866168214681840264081973 \cdot 10^{-269}:\\ \;\;\;\;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}\\ \mathbf{elif}\;x.re \le 2.922951187755237403789063891174243329508 \cdot 10^{-310}:\\ \;\;\;\;e^{\sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \log \left(-x.re\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \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 -3.160936571024873549917158514294633017572 \cdot 10^{-255}:\\
\;\;\;\;e^{\sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \log \left(-x.re\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{elif}\;x.re \le -7.586608897104559866168214681840264081973 \cdot 10^{-269}:\\
\;\;\;\;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}\\

\mathbf{elif}\;x.re \le 2.922951187755237403789063891174243329508 \cdot 10^{-310}:\\
\;\;\;\;e^{\sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \log \left(-x.re\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1367398 = x_re;
        double r1367399 = r1367398 * r1367398;
        double r1367400 = x_im;
        double r1367401 = r1367400 * r1367400;
        double r1367402 = r1367399 + r1367401;
        double r1367403 = sqrt(r1367402);
        double r1367404 = log(r1367403);
        double r1367405 = y_re;
        double r1367406 = r1367404 * r1367405;
        double r1367407 = atan2(r1367400, r1367398);
        double r1367408 = y_im;
        double r1367409 = r1367407 * r1367408;
        double r1367410 = r1367406 - r1367409;
        double r1367411 = exp(r1367410);
        double r1367412 = r1367404 * r1367408;
        double r1367413 = r1367407 * r1367405;
        double r1367414 = r1367412 + r1367413;
        double r1367415 = cos(r1367414);
        double r1367416 = r1367411 * r1367415;
        return r1367416;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1367417 = x_re;
        double r1367418 = -3.1609365710248735e-255;
        bool r1367419 = r1367417 <= r1367418;
        double r1367420 = y_re;
        double r1367421 = cbrt(r1367420);
        double r1367422 = r1367421 * r1367421;
        double r1367423 = -r1367417;
        double r1367424 = log(r1367423);
        double r1367425 = r1367422 * r1367424;
        double r1367426 = r1367421 * r1367425;
        double r1367427 = x_im;
        double r1367428 = atan2(r1367427, r1367417);
        double r1367429 = y_im;
        double r1367430 = r1367428 * r1367429;
        double r1367431 = r1367426 - r1367430;
        double r1367432 = exp(r1367431);
        double r1367433 = -7.58660889710456e-269;
        bool r1367434 = r1367417 <= r1367433;
        double r1367435 = r1367417 * r1367417;
        double r1367436 = r1367427 * r1367427;
        double r1367437 = r1367435 + r1367436;
        double r1367438 = sqrt(r1367437);
        double r1367439 = log(r1367438);
        double r1367440 = r1367439 * r1367420;
        double r1367441 = r1367440 - r1367430;
        double r1367442 = exp(r1367441);
        double r1367443 = 2.92295118775524e-310;
        bool r1367444 = r1367417 <= r1367443;
        double r1367445 = log(r1367417);
        double r1367446 = r1367445 * r1367420;
        double r1367447 = r1367446 - r1367430;
        double r1367448 = exp(r1367447);
        double r1367449 = r1367444 ? r1367432 : r1367448;
        double r1367450 = r1367434 ? r1367442 : r1367449;
        double r1367451 = r1367419 ? r1367432 : r1367450;
        return r1367451;
}

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 3 regimes
  2. if x.re < -3.1609365710248735e-255 or -7.58660889710456e-269 < x.re < 2.92295118775524e-310

    1. Initial program 32.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 17.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. Taylor expanded around -inf 5.8

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

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

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

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

    if -3.1609365710248735e-255 < x.re < -7.58660889710456e-269

    1. Initial program 23.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 13.3

      \[\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}\]

    if 2.92295118775524e-310 < x.re

    1. Initial program 35.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.9

      \[\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 e^{\log \color{blue}{x.re} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -3.160936571024873549917158514294633017572 \cdot 10^{-255}:\\ \;\;\;\;e^{\sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \log \left(-x.re\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le -7.586608897104559866168214681840264081973 \cdot 10^{-269}:\\ \;\;\;\;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}\\ \mathbf{elif}\;x.re \le 2.922951187755237403789063891174243329508 \cdot 10^{-310}:\\ \;\;\;\;e^{\sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \log \left(-x.re\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Reproduce

herbie shell --seed 2019192 
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  (* (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)))))