Average Error: 33.4 → 11.7
Time: 30.2s
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 -2.084005931921038687306891194857517727513 \cdot 10^{-310}:\\ \;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x.re}^{y.re}}{\sqrt{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \sqrt{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{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 -2.084005931921038687306891194857517727513 \cdot 10^{-310}:\\
\;\;\;\;e^{\left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r20639 = x_re;
        double r20640 = r20639 * r20639;
        double r20641 = x_im;
        double r20642 = r20641 * r20641;
        double r20643 = r20640 + r20642;
        double r20644 = sqrt(r20643);
        double r20645 = log(r20644);
        double r20646 = y_re;
        double r20647 = r20645 * r20646;
        double r20648 = atan2(r20641, r20639);
        double r20649 = y_im;
        double r20650 = r20648 * r20649;
        double r20651 = r20647 - r20650;
        double r20652 = exp(r20651);
        double r20653 = r20645 * r20649;
        double r20654 = r20648 * r20646;
        double r20655 = r20653 + r20654;
        double r20656 = cos(r20655);
        double r20657 = r20652 * r20656;
        return r20657;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r20658 = x_re;
        double r20659 = -2.08400593192104e-310;
        bool r20660 = r20658 <= r20659;
        double r20661 = y_re;
        double r20662 = -1.0;
        double r20663 = r20662 / r20658;
        double r20664 = log(r20663);
        double r20665 = r20661 * r20664;
        double r20666 = -r20665;
        double r20667 = x_im;
        double r20668 = atan2(r20667, r20658);
        double r20669 = y_im;
        double r20670 = r20668 * r20669;
        double r20671 = r20666 - r20670;
        double r20672 = exp(r20671);
        double r20673 = pow(r20658, r20661);
        double r20674 = exp(r20668);
        double r20675 = pow(r20674, r20669);
        double r20676 = sqrt(r20675);
        double r20677 = r20676 * r20676;
        double r20678 = r20673 / r20677;
        double r20679 = r20660 ? r20672 : r20678;
        return r20679;
}

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 < -2.08400593192104e-310

    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.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. Taylor expanded around -inf 6.0

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

      \[\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 -2.08400593192104e-310 < 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 22.0

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

      \[\leadsto \color{blue}{\frac{{x.re}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot 1\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt15.4

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

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

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

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

Reproduce

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