Average Error: 33.6 → 10.6
Time: 21.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 5.58752899218811072398574808234057380162 \cdot 10^{-311}:\\ \;\;\;\;e^{-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\\ \mathbf{else}:\\ \;\;\;\;\frac{{x.re}^{y.re} \cdot 1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \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 5.58752899218811072398574808234057380162 \cdot 10^{-311}:\\
\;\;\;\;e^{-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\\

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r21667 = x_re;
        double r21668 = r21667 * r21667;
        double r21669 = x_im;
        double r21670 = r21669 * r21669;
        double r21671 = r21668 + r21670;
        double r21672 = sqrt(r21671);
        double r21673 = log(r21672);
        double r21674 = y_re;
        double r21675 = r21673 * r21674;
        double r21676 = atan2(r21669, r21667);
        double r21677 = y_im;
        double r21678 = r21676 * r21677;
        double r21679 = r21675 - r21678;
        double r21680 = exp(r21679);
        double r21681 = r21673 * r21677;
        double r21682 = r21676 * r21674;
        double r21683 = r21681 + r21682;
        double r21684 = cos(r21683);
        double r21685 = r21680 * r21684;
        return r21685;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r21686 = x_re;
        double r21687 = 5.5875289921881e-311;
        bool r21688 = r21686 <= r21687;
        double r21689 = -1.0;
        double r21690 = y_re;
        double r21691 = r21689 / r21686;
        double r21692 = log(r21691);
        double r21693 = r21690 * r21692;
        double r21694 = r21689 * r21693;
        double r21695 = x_im;
        double r21696 = atan2(r21695, r21686);
        double r21697 = y_im;
        double r21698 = r21696 * r21697;
        double r21699 = r21694 - r21698;
        double r21700 = exp(r21699);
        double r21701 = 1.0;
        double r21702 = r21700 * r21701;
        double r21703 = pow(r21686, r21690);
        double r21704 = r21703 * r21701;
        double r21705 = exp(r21698);
        double r21706 = r21704 / r21705;
        double r21707 = r21706 * r21701;
        double r21708 = r21688 ? r21702 : r21707;
        return r21708;
}

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 < 5.5875289921881e-311

    1. Initial program 32.2

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

    if 5.5875289921881e-311 < 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 21.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 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.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le 5.58752899218811072398574808234057380162 \cdot 10^{-311}:\\ \;\;\;\;e^{-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\\ \mathbf{else}:\\ \;\;\;\;\frac{{x.re}^{y.re} \cdot 1}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot 1\\ \end{array}\]

Reproduce

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