Average Error: 33.4 → 9.0
Time: 30.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 -3.4314204147347351 \cdot 10^{-305}:\\ \;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le 1.09754605698981795 \cdot 10^{-112} \lor \neg \left(x.re \le 6.86906973714539557 \cdot 10^{-6}\right):\\ \;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt[3]{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{3}}\right) \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.4314204147347351 \cdot 10^{-305}:\\
\;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{elif}\;x.re \le 1.09754605698981795 \cdot 10^{-112} \lor \neg \left(x.re \le 6.86906973714539557 \cdot 10^{-6}\right):\\
\;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{else}:\\
\;\;\;\;e^{\log \left(\sqrt[3]{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{3}}\right) \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 r21541 = x_re;
        double r21542 = r21541 * r21541;
        double r21543 = x_im;
        double r21544 = r21543 * r21543;
        double r21545 = r21542 + r21544;
        double r21546 = sqrt(r21545);
        double r21547 = log(r21546);
        double r21548 = y_re;
        double r21549 = r21547 * r21548;
        double r21550 = atan2(r21543, r21541);
        double r21551 = y_im;
        double r21552 = r21550 * r21551;
        double r21553 = r21549 - r21552;
        double r21554 = exp(r21553);
        double r21555 = r21547 * r21551;
        double r21556 = r21550 * r21548;
        double r21557 = r21555 + r21556;
        double r21558 = cos(r21557);
        double r21559 = r21554 * r21558;
        return r21559;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r21560 = x_re;
        double r21561 = -3.431420414734735e-305;
        bool r21562 = r21560 <= r21561;
        double r21563 = y_re;
        double r21564 = -1.0;
        double r21565 = r21564 / r21560;
        double r21566 = log(r21565);
        double r21567 = r21563 * r21566;
        double r21568 = -r21567;
        double r21569 = x_im;
        double r21570 = atan2(r21569, r21560);
        double r21571 = y_im;
        double r21572 = r21570 * r21571;
        double r21573 = r21568 - r21572;
        double r21574 = exp(r21573);
        double r21575 = 1.097546056989818e-112;
        bool r21576 = r21560 <= r21575;
        double r21577 = 6.8690697371453956e-06;
        bool r21578 = r21560 <= r21577;
        double r21579 = !r21578;
        bool r21580 = r21576 || r21579;
        double r21581 = log(r21560);
        double r21582 = r21563 * r21581;
        double r21583 = r21582 - r21572;
        double r21584 = exp(r21583);
        double r21585 = r21560 * r21560;
        double r21586 = r21569 * r21569;
        double r21587 = r21585 + r21586;
        double r21588 = sqrt(r21587);
        double r21589 = 3.0;
        double r21590 = pow(r21588, r21589);
        double r21591 = cbrt(r21590);
        double r21592 = log(r21591);
        double r21593 = r21592 * r21563;
        double r21594 = r21593 - r21572;
        double r21595 = exp(r21594);
        double r21596 = r21580 ? r21584 : r21595;
        double r21597 = r21562 ? r21574 : r21596;
        return r21597;
}

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.431420414734735e-305

    1. Initial program 32.0

      \[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. Using strategy rm
    4. Applied add-cbrt-cube23.7

      \[\leadsto e^{\log \color{blue}{\left(\sqrt[3]{\left(\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 \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. Simplified23.7

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

      \[\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\]
    7. Simplified6.1

      \[\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 -3.431420414734735e-305 < x.re < 1.097546056989818e-112 or 6.8690697371453956e-06 < x.re

    1. Initial program 37.7

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

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

      \[\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. Simplified11.3

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

    if 1.097546056989818e-112 < x.re < 6.8690697371453956e-06

    1. Initial program 19.6

      \[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 12.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. Using strategy rm
    4. Applied add-cbrt-cube14.7

      \[\leadsto e^{\log \color{blue}{\left(\sqrt[3]{\left(\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 \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. Simplified14.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -3.4314204147347351 \cdot 10^{-305}:\\ \;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le 1.09754605698981795 \cdot 10^{-112} \lor \neg \left(x.re \le 6.86906973714539557 \cdot 10^{-6}\right):\\ \;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt[3]{{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{3}}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Reproduce

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