Average Error: 33.1 → 12.0
Time: 12.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.66980863590209088 \cdot 10^{152}:\\ \;\;\;\;\frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}} \cdot \frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}}\\ \mathbf{elif}\;x.re \le -1.59936965632703645 \cdot 10^{57}:\\ \;\;\;\;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 \sqrt[3]{{\left(\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)}^{3}}\\ \mathbf{elif}\;x.re \le -9.31714005079649 \cdot 10^{-312}:\\ \;\;\;\;\frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}} \cdot \frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.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.66980863590209088 \cdot 10^{152}:\\
\;\;\;\;\frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}} \cdot \frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}}\\

\mathbf{elif}\;x.re \le -1.59936965632703645 \cdot 10^{57}:\\
\;\;\;\;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 \sqrt[3]{{\left(\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)}^{3}}\\

\mathbf{elif}\;x.re \le -9.31714005079649 \cdot 10^{-312}:\\
\;\;\;\;\frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}} \cdot \frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}}\\

\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.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 r14850 = x_re;
        double r14851 = r14850 * r14850;
        double r14852 = x_im;
        double r14853 = r14852 * r14852;
        double r14854 = r14851 + r14853;
        double r14855 = sqrt(r14854);
        double r14856 = log(r14855);
        double r14857 = y_re;
        double r14858 = r14856 * r14857;
        double r14859 = atan2(r14852, r14850);
        double r14860 = y_im;
        double r14861 = r14859 * r14860;
        double r14862 = r14858 - r14861;
        double r14863 = exp(r14862);
        double r14864 = r14856 * r14860;
        double r14865 = r14859 * r14857;
        double r14866 = r14864 + r14865;
        double r14867 = cos(r14866);
        double r14868 = r14863 * r14867;
        return r14868;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14869 = x_re;
        double r14870 = -1.669808635902091e+152;
        bool r14871 = r14869 <= r14870;
        double r14872 = x_im;
        double r14873 = atan2(r14872, r14869);
        double r14874 = y_im;
        double r14875 = r14873 * r14874;
        double r14876 = -r14875;
        double r14877 = exp(r14876);
        double r14878 = sqrt(r14877);
        double r14879 = -1.0;
        double r14880 = r14879 / r14869;
        double r14881 = y_re;
        double r14882 = 2.0;
        double r14883 = r14881 / r14882;
        double r14884 = pow(r14880, r14883);
        double r14885 = r14878 / r14884;
        double r14886 = r14885 * r14885;
        double r14887 = -1.5993696563270364e+57;
        bool r14888 = r14869 <= r14887;
        double r14889 = r14869 * r14869;
        double r14890 = r14872 * r14872;
        double r14891 = r14889 + r14890;
        double r14892 = sqrt(r14891);
        double r14893 = log(r14892);
        double r14894 = r14893 * r14881;
        double r14895 = r14894 - r14875;
        double r14896 = exp(r14895);
        double r14897 = r14893 * r14874;
        double r14898 = r14873 * r14881;
        double r14899 = r14897 + r14898;
        double r14900 = cos(r14899);
        double r14901 = 3.0;
        double r14902 = pow(r14900, r14901);
        double r14903 = cbrt(r14902);
        double r14904 = r14896 * r14903;
        double r14905 = -9.3171400507965e-312;
        bool r14906 = r14869 <= r14905;
        double r14907 = log(r14869);
        double r14908 = r14881 * r14907;
        double r14909 = r14908 - r14875;
        double r14910 = exp(r14909);
        double r14911 = r14906 ? r14886 : r14910;
        double r14912 = r14888 ? r14904 : r14911;
        double r14913 = r14871 ? r14886 : r14912;
        return r14913;
}

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 < -1.669808635902091e+152 or -1.5993696563270364e+57 < x.re < -9.3171400507965e-312

    1. Initial program 34.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 19.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 6.9

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

      \[\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\]
    5. Using strategy rm
    6. Applied sqr-pow11.7

      \[\leadsto \frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\color{blue}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)} \cdot {\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}}} \cdot 1\]
    7. Applied add-sqr-sqrt11.7

      \[\leadsto \frac{\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}}}}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)} \cdot {\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{2}\right)}} \cdot 1\]
    8. Applied times-frac11.7

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

    if -1.669808635902091e+152 < x.re < -1.5993696563270364e+57

    1. Initial program 15.5

      \[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-cbrt-cube15.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}{\sqrt[3]{\left(\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 \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 \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. Simplified15.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 \sqrt[3]{\color{blue}{{\left(\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)}^{3}}}\]

    if -9.3171400507965e-312 < x.re

    1. Initial program 34.8

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

      \[\leadsto e^{\color{blue}{y.re \cdot \log x.re} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
  3. Recombined 3 regimes into one program.
  4. Final simplification12.0

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

Reproduce

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