Average Error: 33.2 → 10.7
Time: 7.3s
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.786414519364885 \cdot 10^{-309}:\\ \;\;\;\;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{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{1}{x.re}\right)}^{y.re}} \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 -1.786414519364885 \cdot 10^{-309}:\\
\;\;\;\;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{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{1}{x.re}\right)}^{y.re}} \cdot 1\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r13757 = x_re;
        double r13758 = r13757 * r13757;
        double r13759 = x_im;
        double r13760 = r13759 * r13759;
        double r13761 = r13758 + r13760;
        double r13762 = sqrt(r13761);
        double r13763 = log(r13762);
        double r13764 = y_re;
        double r13765 = r13763 * r13764;
        double r13766 = atan2(r13759, r13757);
        double r13767 = y_im;
        double r13768 = r13766 * r13767;
        double r13769 = r13765 - r13768;
        double r13770 = exp(r13769);
        double r13771 = r13763 * r13767;
        double r13772 = r13766 * r13764;
        double r13773 = r13771 + r13772;
        double r13774 = cos(r13773);
        double r13775 = r13770 * r13774;
        return r13775;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r13776 = x_re;
        double r13777 = -1.786414519364885e-309;
        bool r13778 = r13776 <= r13777;
        double r13779 = -1.0;
        double r13780 = y_re;
        double r13781 = r13779 / r13776;
        double r13782 = log(r13781);
        double r13783 = r13780 * r13782;
        double r13784 = r13779 * r13783;
        double r13785 = x_im;
        double r13786 = atan2(r13785, r13776);
        double r13787 = y_im;
        double r13788 = r13786 * r13787;
        double r13789 = r13784 - r13788;
        double r13790 = exp(r13789);
        double r13791 = 1.0;
        double r13792 = r13790 * r13791;
        double r13793 = -r13788;
        double r13794 = exp(r13793);
        double r13795 = r13791 / r13776;
        double r13796 = pow(r13795, r13780);
        double r13797 = r13794 / r13796;
        double r13798 = r13797 * r13791;
        double r13799 = r13778 ? r13792 : r13798;
        return r13799;
}

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.786414519364885e-309

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

      \[\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 -1.786414519364885e-309 < x.re

    1. Initial program 34.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.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. Simplified15.2

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

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

Reproduce

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