Average Error: 33.5 → 10.0
Time: 31.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 -1.448187283069527930834397011494729667902:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le -1.085931852353555088293647174477075724596 \cdot 10^{-71}:\\ \;\;\;\;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}\\ \mathbf{elif}\;x.re \le -8.840626789860416774620000671155810028577 \cdot 10^{-152}:\\ \;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot {\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)}^{4}\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.im\right)}}\\ \mathbf{elif}\;x.re \le 2.910618682483124596927217326473379984398 \cdot 10^{-307}:\\ \;\;\;\;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}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \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 -1.448187283069527930834397011494729667902:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{elif}\;x.re \le -1.085931852353555088293647174477075724596 \cdot 10^{-71}:\\
\;\;\;\;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}\\

\mathbf{elif}\;x.re \le -8.840626789860416774620000671155810028577 \cdot 10^{-152}:\\
\;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot {\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)}^{4}\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.im\right)}}\\

\mathbf{elif}\;x.re \le 2.910618682483124596927217326473379984398 \cdot 10^{-307}:\\
\;\;\;\;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}\\

\mathbf{else}:\\
\;\;\;\;e^{\log x.re \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 r20718 = x_re;
        double r20719 = r20718 * r20718;
        double r20720 = x_im;
        double r20721 = r20720 * r20720;
        double r20722 = r20719 + r20721;
        double r20723 = sqrt(r20722);
        double r20724 = log(r20723);
        double r20725 = y_re;
        double r20726 = r20724 * r20725;
        double r20727 = atan2(r20720, r20718);
        double r20728 = y_im;
        double r20729 = r20727 * r20728;
        double r20730 = r20726 - r20729;
        double r20731 = exp(r20730);
        double r20732 = r20724 * r20728;
        double r20733 = r20727 * r20725;
        double r20734 = r20732 + r20733;
        double r20735 = cos(r20734);
        double r20736 = r20731 * r20735;
        return r20736;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r20737 = x_re;
        double r20738 = -1.448187283069528;
        bool r20739 = r20737 <= r20738;
        double r20740 = -r20737;
        double r20741 = log(r20740);
        double r20742 = y_re;
        double r20743 = r20741 * r20742;
        double r20744 = x_im;
        double r20745 = atan2(r20744, r20737);
        double r20746 = y_im;
        double r20747 = r20745 * r20746;
        double r20748 = r20743 - r20747;
        double r20749 = exp(r20748);
        double r20750 = -1.085931852353555e-71;
        bool r20751 = r20737 <= r20750;
        double r20752 = r20737 * r20737;
        double r20753 = r20744 * r20744;
        double r20754 = r20752 + r20753;
        double r20755 = sqrt(r20754);
        double r20756 = log(r20755);
        double r20757 = r20756 * r20742;
        double r20758 = r20757 - r20747;
        double r20759 = exp(r20758);
        double r20760 = -8.840626789860417e-152;
        bool r20761 = r20737 <= r20760;
        double r20762 = -1.0;
        double r20763 = r20762 / r20737;
        double r20764 = -r20742;
        double r20765 = pow(r20763, r20764);
        double r20766 = cbrt(r20745);
        double r20767 = cbrt(r20766);
        double r20768 = r20767 * r20767;
        double r20769 = 4.0;
        double r20770 = pow(r20767, r20769);
        double r20771 = r20768 * r20770;
        double r20772 = r20766 * r20746;
        double r20773 = r20771 * r20772;
        double r20774 = exp(r20773);
        double r20775 = r20765 / r20774;
        double r20776 = 2.9106186824831246e-307;
        bool r20777 = r20737 <= r20776;
        double r20778 = log(r20737);
        double r20779 = r20778 * r20742;
        double r20780 = r20779 - r20747;
        double r20781 = exp(r20780);
        double r20782 = r20777 ? r20759 : r20781;
        double r20783 = r20761 ? r20775 : r20782;
        double r20784 = r20751 ? r20759 : r20783;
        double r20785 = r20739 ? r20749 : r20784;
        return r20785;
}

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 4 regimes
  2. if x.re < -1.448187283069528

    1. Initial program 39.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.6

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

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

      \[\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.448187283069528 < x.re < -1.085931852353555e-71 or -8.840626789860417e-152 < x.re < 2.9106186824831246e-307

    1. Initial program 26.4

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

      \[\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}\]

    if -1.085931852353555e-71 < x.re < -8.840626789860417e-152

    1. Initial program 16.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 8.7

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

      \[\leadsto \color{blue}{\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot 1\]
    5. Using strategy rm
    6. Applied add-cube-cbrt15.3

      \[\leadsto \frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\color{blue}{\left(\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right)} \cdot y.im}} \cdot 1\]
    7. Applied associate-*l*15.3

      \[\leadsto \frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\color{blue}{\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.im\right)}}} \cdot 1\]
    8. Using strategy rm
    9. Applied add-cube-cbrt15.3

      \[\leadsto \frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\left(\color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.im\right)}} \cdot 1\]
    10. Applied associate-*l*15.3

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

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

    if 2.9106186824831246e-307 < x.re

    1. Initial program 35.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 22.3

      \[\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 e^{\log \color{blue}{x.re} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
  3. Recombined 4 regimes into one program.
  4. Final simplification10.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -1.448187283069527930834397011494729667902:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le -1.085931852353555088293647174477075724596 \cdot 10^{-71}:\\ \;\;\;\;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}\\ \mathbf{elif}\;x.re \le -8.840626789860416774620000671155810028577 \cdot 10^{-152}:\\ \;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot {\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)}^{4}\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.im\right)}}\\ \mathbf{elif}\;x.re \le 2.910618682483124596927217326473379984398 \cdot 10^{-307}:\\ \;\;\;\;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}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Reproduce

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