Average Error: 33.1 → 11.4
Time: 5.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 -6.98150582813318261 \cdot 10^{-46}:\\ \;\;\;\;\left(\frac{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{\sqrt[3]{-1} \cdot \sqrt[3]{-1}}{1}\right)}^{y.re}} \cdot \frac{\sqrt{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot \sqrt{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{{\left(\frac{\sqrt[3]{-1}}{x.re}\right)}^{y.re}}\right) \cdot 1\\ \mathbf{elif}\;x.re \le -1.0812928157068453 \cdot 10^{-151}:\\ \;\;\;\;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{elif}\;x.re \le -2.86521398010845681 \cdot 10^{-285}:\\ \;\;\;\;\left(\sqrt{\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}}} \cdot \sqrt{\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) \cdot 1\\ \mathbf{elif}\;x.re \le 7.6271351629446574 \cdot 10^{-301}:\\ \;\;\;\;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 -6.98150582813318261 \cdot 10^{-46}:\\
\;\;\;\;\left(\frac{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{\sqrt[3]{-1} \cdot \sqrt[3]{-1}}{1}\right)}^{y.re}} \cdot \frac{\sqrt{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot \sqrt{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{{\left(\frac{\sqrt[3]{-1}}{x.re}\right)}^{y.re}}\right) \cdot 1\\

\mathbf{elif}\;x.re \le -1.0812928157068453 \cdot 10^{-151}:\\
\;\;\;\;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{elif}\;x.re \le -2.86521398010845681 \cdot 10^{-285}:\\
\;\;\;\;\left(\sqrt{\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}}} \cdot \sqrt{\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) \cdot 1\\

\mathbf{elif}\;x.re \le 7.6271351629446574 \cdot 10^{-301}:\\
\;\;\;\;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 r13956 = x_re;
        double r13957 = r13956 * r13956;
        double r13958 = x_im;
        double r13959 = r13958 * r13958;
        double r13960 = r13957 + r13959;
        double r13961 = sqrt(r13960);
        double r13962 = log(r13961);
        double r13963 = y_re;
        double r13964 = r13962 * r13963;
        double r13965 = atan2(r13958, r13956);
        double r13966 = y_im;
        double r13967 = r13965 * r13966;
        double r13968 = r13964 - r13967;
        double r13969 = exp(r13968);
        double r13970 = r13962 * r13966;
        double r13971 = r13965 * r13963;
        double r13972 = r13970 + r13971;
        double r13973 = cos(r13972);
        double r13974 = r13969 * r13973;
        return r13974;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r13975 = x_re;
        double r13976 = -6.9815058281331826e-46;
        bool r13977 = r13975 <= r13976;
        double r13978 = x_im;
        double r13979 = atan2(r13978, r13975);
        double r13980 = y_im;
        double r13981 = r13979 * r13980;
        double r13982 = -r13981;
        double r13983 = exp(r13982);
        double r13984 = cbrt(r13983);
        double r13985 = r13984 * r13984;
        double r13986 = -1.0;
        double r13987 = cbrt(r13986);
        double r13988 = r13987 * r13987;
        double r13989 = 1.0;
        double r13990 = r13988 / r13989;
        double r13991 = y_re;
        double r13992 = pow(r13990, r13991);
        double r13993 = r13985 / r13992;
        double r13994 = sqrt(r13984);
        double r13995 = r13994 * r13994;
        double r13996 = r13987 / r13975;
        double r13997 = pow(r13996, r13991);
        double r13998 = r13995 / r13997;
        double r13999 = r13993 * r13998;
        double r14000 = r13999 * r13989;
        double r14001 = -1.0812928157068453e-151;
        bool r14002 = r13975 <= r14001;
        double r14003 = r13975 * r13975;
        double r14004 = r13978 * r13978;
        double r14005 = r14003 + r14004;
        double r14006 = sqrt(r14005);
        double r14007 = log(r14006);
        double r14008 = r14007 * r13991;
        double r14009 = r14008 - r13981;
        double r14010 = exp(r14009);
        double r14011 = r14010 * r13989;
        double r14012 = -2.8652139801084568e-285;
        bool r14013 = r13975 <= r14012;
        double r14014 = r13986 / r13975;
        double r14015 = pow(r14014, r13991);
        double r14016 = r13983 / r14015;
        double r14017 = sqrt(r14016);
        double r14018 = r14017 * r14017;
        double r14019 = r14018 * r13989;
        double r14020 = 7.627135162944657e-301;
        bool r14021 = r13975 <= r14020;
        double r14022 = log(r13975);
        double r14023 = r14022 * r13991;
        double r14024 = r14023 - r13981;
        double r14025 = exp(r14024);
        double r14026 = r14025 * r13989;
        double r14027 = r14021 ? r14011 : r14026;
        double r14028 = r14013 ? r14019 : r14027;
        double r14029 = r14002 ? r14011 : r14028;
        double r14030 = r13977 ? r14000 : r14029;
        return r14030;
}

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 < -6.9815058281331826e-46

    1. Initial program 37.6

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

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

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

      \[\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 *-un-lft-identity9.3

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

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

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

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

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

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

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

    if -6.9815058281331826e-46 < x.re < -1.0812928157068453e-151 or -2.8652139801084568e-285 < x.re < 7.627135162944657e-301

    1. Initial program 19.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 10.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}\]

    if -1.0812928157068453e-151 < x.re < -2.8652139801084568e-285

    1. Initial program 29.6

      \[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 16.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 12.3

      \[\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.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 add-sqr-sqrt15.7

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

    if 7.627135162944657e-301 < x.re

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -6.98150582813318261 \cdot 10^{-46}:\\ \;\;\;\;\left(\frac{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{{\left(\frac{\sqrt[3]{-1} \cdot \sqrt[3]{-1}}{1}\right)}^{y.re}} \cdot \frac{\sqrt{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot \sqrt{\sqrt[3]{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{{\left(\frac{\sqrt[3]{-1}}{x.re}\right)}^{y.re}}\right) \cdot 1\\ \mathbf{elif}\;x.re \le -1.0812928157068453 \cdot 10^{-151}:\\ \;\;\;\;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{elif}\;x.re \le -2.86521398010845681 \cdot 10^{-285}:\\ \;\;\;\;\left(\sqrt{\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}}} \cdot \sqrt{\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) \cdot 1\\ \mathbf{elif}\;x.re \le 7.6271351629446574 \cdot 10^{-301}:\\ \;\;\;\;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 2020024 
(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)))))