Average Error: 33.4 → 9.2
Time: 46.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.225334471931207730885249578744776861647 \cdot 10^{-312}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \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.225334471931207730885249578744776861647 \cdot 10^{-312}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1540517 = x_re;
        double r1540518 = r1540517 * r1540517;
        double r1540519 = x_im;
        double r1540520 = r1540519 * r1540519;
        double r1540521 = r1540518 + r1540520;
        double r1540522 = sqrt(r1540521);
        double r1540523 = log(r1540522);
        double r1540524 = y_re;
        double r1540525 = r1540523 * r1540524;
        double r1540526 = atan2(r1540519, r1540517);
        double r1540527 = y_im;
        double r1540528 = r1540526 * r1540527;
        double r1540529 = r1540525 - r1540528;
        double r1540530 = exp(r1540529);
        double r1540531 = r1540523 * r1540527;
        double r1540532 = r1540526 * r1540524;
        double r1540533 = r1540531 + r1540532;
        double r1540534 = cos(r1540533);
        double r1540535 = r1540530 * r1540534;
        return r1540535;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1540536 = x_re;
        double r1540537 = -1.2253344719312e-312;
        bool r1540538 = r1540536 <= r1540537;
        double r1540539 = -r1540536;
        double r1540540 = log(r1540539);
        double r1540541 = y_re;
        double r1540542 = r1540540 * r1540541;
        double r1540543 = y_im;
        double r1540544 = x_im;
        double r1540545 = atan2(r1540544, r1540536);
        double r1540546 = r1540543 * r1540545;
        double r1540547 = r1540542 - r1540546;
        double r1540548 = exp(r1540547);
        double r1540549 = log(r1540536);
        double r1540550 = r1540549 * r1540541;
        double r1540551 = r1540550 - r1540546;
        double r1540552 = exp(r1540551);
        double r1540553 = r1540538 ? r1540548 : r1540552;
        return r1540553;
}

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.2253344719312e-312

    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.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 6.2

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

      \[\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 -1.2253344719312e-312 < x.re

    1. Initial program 34.8

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

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

      \[\leadsto e^{\log \left(\sqrt[3]{\color{blue}{\left(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\]
    6. 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 2 regimes into one program.
  4. Final simplification9.2

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

Reproduce

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