Average Error: 33.5 → 11.7
Time: 29.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 -146157.60732674621976912021636962890625:\\ \;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\ \mathbf{elif}\;x.re \le -3.33209726947843857182023251731571357718 \cdot 10^{-105}:\\ \;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \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 \left(\left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)}\right) \cdot \sqrt[3]{\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)}\right)\\ \mathbf{elif}\;x.re \le -1.59374399213355371237820721800241253786 \cdot 10^{-310}:\\ \;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\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 -146157.60732674621976912021636962890625:\\
\;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\

\mathbf{elif}\;x.re \le -3.33209726947843857182023251731571357718 \cdot 10^{-105}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \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 \left(\left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)}\right) \cdot \sqrt[3]{\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)}\right)\\

\mathbf{elif}\;x.re \le -1.59374399213355371237820721800241253786 \cdot 10^{-310}:\\
\;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\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 r23730 = x_re;
        double r23731 = r23730 * r23730;
        double r23732 = x_im;
        double r23733 = r23732 * r23732;
        double r23734 = r23731 + r23733;
        double r23735 = sqrt(r23734);
        double r23736 = log(r23735);
        double r23737 = y_re;
        double r23738 = r23736 * r23737;
        double r23739 = atan2(r23732, r23730);
        double r23740 = y_im;
        double r23741 = r23739 * r23740;
        double r23742 = r23738 - r23741;
        double r23743 = exp(r23742);
        double r23744 = r23736 * r23740;
        double r23745 = r23739 * r23737;
        double r23746 = r23744 + r23745;
        double r23747 = cos(r23746);
        double r23748 = r23743 * r23747;
        return r23748;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r23749 = x_re;
        double r23750 = -146157.60732674622;
        bool r23751 = r23749 <= r23750;
        double r23752 = -1.0;
        double r23753 = r23752 / r23749;
        double r23754 = y_re;
        double r23755 = -r23754;
        double r23756 = pow(r23753, r23755);
        double r23757 = x_im;
        double r23758 = atan2(r23757, r23749);
        double r23759 = y_im;
        double r23760 = r23758 * r23759;
        double r23761 = exp(r23760);
        double r23762 = r23756 / r23761;
        double r23763 = -3.3320972694784386e-105;
        bool r23764 = r23749 <= r23763;
        double r23765 = r23749 * r23749;
        double r23766 = r23757 * r23757;
        double r23767 = r23765 + r23766;
        double r23768 = sqrt(r23767);
        double r23769 = log(r23768);
        double r23770 = r23769 * r23754;
        double r23771 = cbrt(r23758);
        double r23772 = r23771 * r23771;
        double r23773 = r23771 * r23759;
        double r23774 = r23772 * r23773;
        double r23775 = r23770 - r23774;
        double r23776 = exp(r23775);
        double r23777 = r23769 * r23759;
        double r23778 = r23758 * r23754;
        double r23779 = r23777 + r23778;
        double r23780 = cos(r23779);
        double r23781 = cbrt(r23780);
        double r23782 = r23781 * r23781;
        double r23783 = r23782 * r23781;
        double r23784 = r23776 * r23783;
        double r23785 = -1.59374399213355e-310;
        bool r23786 = r23749 <= r23785;
        double r23787 = log(r23749);
        double r23788 = r23787 * r23754;
        double r23789 = r23788 - r23760;
        double r23790 = exp(r23789);
        double r23791 = r23786 ? r23762 : r23790;
        double r23792 = r23764 ? r23784 : r23791;
        double r23793 = r23751 ? r23762 : r23792;
        return r23793;
}

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 3 regimes
  2. if x.re < -146157.60732674622 or -3.3320972694784386e-105 < x.re < -1.59374399213355e-310

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

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

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

    if -146157.60732674622 < x.re < -3.3320972694784386e-105

    1. Initial program 15.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. Using strategy rm
    3. Applied add-cube-cbrt15.4

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \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 \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)\]
    4. Applied associate-*l*15.4

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \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 \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)\]
    5. Using strategy rm
    6. Applied add-cube-cbrt15.4

      \[\leadsto e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \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 \color{blue}{\left(\left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)}\right) \cdot \sqrt[3]{\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)}\right)}\]

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -146157.60732674621976912021636962890625:\\ \;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\ \mathbf{elif}\;x.re \le -3.33209726947843857182023251731571357718 \cdot 10^{-105}:\\ \;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \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 \left(\left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)}\right) \cdot \sqrt[3]{\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)}\right)\\ \mathbf{elif}\;x.re \le -1.59374399213355371237820721800241253786 \cdot 10^{-310}:\\ \;\;\;\;\frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\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 2019304 
(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)))))