Average Error: 33.8 → 10.1
Time: 7.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 -5.06609217563672125851584959914894070598 \cdot 10^{-261}:\\ \;\;\;\;{\left(e^{\sqrt[3]{-\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)} \cdot \sqrt[3]{-\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)}}\right)}^{\left(\sqrt[3]{-\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)}\right)} \cdot 1\\ \mathbf{elif}\;x.re \le 0.9896125733904901355941774454549886286259:\\ \;\;\;\;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 1\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \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.06609217563672125851584959914894070598 \cdot 10^{-261}:\\
\;\;\;\;{\left(e^{\sqrt[3]{-\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)} \cdot \sqrt[3]{-\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)}}\right)}^{\left(\sqrt[3]{-\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)}\right)} \cdot 1\\

\mathbf{elif}\;x.re \le 0.9896125733904901355941774454549886286259:\\
\;\;\;\;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 1\\

\mathbf{else}:\\
\;\;\;\;e^{\log x.re \cdot y.re - \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 r14803 = x_re;
        double r14804 = r14803 * r14803;
        double r14805 = x_im;
        double r14806 = r14805 * r14805;
        double r14807 = r14804 + r14806;
        double r14808 = sqrt(r14807);
        double r14809 = log(r14808);
        double r14810 = y_re;
        double r14811 = r14809 * r14810;
        double r14812 = atan2(r14805, r14803);
        double r14813 = y_im;
        double r14814 = r14812 * r14813;
        double r14815 = r14811 - r14814;
        double r14816 = exp(r14815);
        double r14817 = r14809 * r14813;
        double r14818 = r14812 * r14810;
        double r14819 = r14817 + r14818;
        double r14820 = cos(r14819);
        double r14821 = r14816 * r14820;
        return r14821;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14822 = x_re;
        double r14823 = -5.066092175636721e-261;
        bool r14824 = r14822 <= r14823;
        double r14825 = x_im;
        double r14826 = atan2(r14825, r14822);
        double r14827 = y_im;
        double r14828 = r14826 * r14827;
        double r14829 = y_re;
        double r14830 = -1.0;
        double r14831 = r14830 / r14822;
        double r14832 = log(r14831);
        double r14833 = r14829 * r14832;
        double r14834 = r14828 + r14833;
        double r14835 = -r14834;
        double r14836 = cbrt(r14835);
        double r14837 = r14836 * r14836;
        double r14838 = exp(r14837);
        double r14839 = pow(r14838, r14836);
        double r14840 = 1.0;
        double r14841 = r14839 * r14840;
        double r14842 = 0.9896125733904901;
        bool r14843 = r14822 <= r14842;
        double r14844 = r14822 * r14822;
        double r14845 = r14825 * r14825;
        double r14846 = r14844 + r14845;
        double r14847 = sqrt(r14846);
        double r14848 = log(r14847);
        double r14849 = r14848 * r14829;
        double r14850 = r14849 - r14828;
        double r14851 = exp(r14850);
        double r14852 = r14851 * r14840;
        double r14853 = log(r14822);
        double r14854 = r14853 * r14829;
        double r14855 = r14854 - r14828;
        double r14856 = exp(r14855);
        double r14857 = r14856 * r14840;
        double r14858 = r14843 ? r14852 : r14857;
        double r14859 = r14824 ? r14841 : r14858;
        return r14859;
}

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 < -5.066092175636721e-261

    1. Initial program 32.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 17.2

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

      \[\leadsto e^{\color{blue}{-\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. Using strategy rm
    5. Applied add-cube-cbrt6.1

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

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

    if -5.066092175636721e-261 < x.re < 0.9896125733904901

    1. Initial program 26.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 15.4

      \[\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 0.9896125733904901 < x.re

    1. Initial program 45.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 29.4

      \[\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 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 simplification10.1

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

Reproduce

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