Average Error: 32.8 → 11.2
Time: 25.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 -6.066276555501723625812709864772430660358 \cdot 10^{-38}:\\ \;\;\;\;e^{-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\\ \mathbf{elif}\;x.re \le 1.358383976200773897428690001330946993614 \cdot 10^{-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 1\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{\frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}} \cdot \frac{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{\frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}}\right) \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.066276555501723625812709864772430660358 \cdot 10^{-38}:\\
\;\;\;\;e^{-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\\

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

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{\frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}} \cdot \frac{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{\frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}}\right) \cdot 1\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r32763 = x_re;
        double r32764 = r32763 * r32763;
        double r32765 = x_im;
        double r32766 = r32765 * r32765;
        double r32767 = r32764 + r32766;
        double r32768 = sqrt(r32767);
        double r32769 = log(r32768);
        double r32770 = y_re;
        double r32771 = r32769 * r32770;
        double r32772 = atan2(r32765, r32763);
        double r32773 = y_im;
        double r32774 = r32772 * r32773;
        double r32775 = r32771 - r32774;
        double r32776 = exp(r32775);
        double r32777 = r32769 * r32773;
        double r32778 = r32772 * r32770;
        double r32779 = r32777 + r32778;
        double r32780 = cos(r32779);
        double r32781 = r32776 * r32780;
        return r32781;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r32782 = x_re;
        double r32783 = -6.066276555501724e-38;
        bool r32784 = r32782 <= r32783;
        double r32785 = -1.0;
        double r32786 = y_re;
        double r32787 = r32785 / r32782;
        double r32788 = log(r32787);
        double r32789 = r32786 * r32788;
        double r32790 = r32785 * r32789;
        double r32791 = x_im;
        double r32792 = atan2(r32791, r32782);
        double r32793 = y_im;
        double r32794 = r32792 * r32793;
        double r32795 = r32790 - r32794;
        double r32796 = exp(r32795);
        double r32797 = 1.0;
        double r32798 = r32796 * r32797;
        double r32799 = 1.3583839762007739e-64;
        bool r32800 = r32782 <= r32799;
        double r32801 = r32782 * r32782;
        double r32802 = r32791 * r32791;
        double r32803 = r32801 + r32802;
        double r32804 = sqrt(r32803);
        double r32805 = log(r32804);
        double r32806 = r32805 * r32786;
        double r32807 = r32806 - r32794;
        double r32808 = exp(r32807);
        double r32809 = r32808 * r32797;
        double r32810 = -r32794;
        double r32811 = exp(r32810);
        double r32812 = sqrt(r32811);
        double r32813 = sqrt(r32812);
        double r32814 = r32797 / r32782;
        double r32815 = pow(r32814, r32786);
        double r32816 = sqrt(r32815);
        double r32817 = r32816 / r32813;
        double r32818 = r32813 / r32817;
        double r32819 = r32818 * r32818;
        double r32820 = r32819 * r32797;
        double r32821 = r32800 ? r32809 : r32820;
        double r32822 = r32784 ? r32798 : r32821;
        return r32822;
}

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 < -6.066276555501724e-38

    1. Initial program 37.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 20.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}\]
    3. Taylor expanded around -inf 2.1

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

    if -6.066276555501724e-38 < x.re < 1.3583839762007739e-64

    1. Initial program 25.1

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

    if 1.3583839762007739e-64 < x.re

    1. Initial program 38.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 24.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 11.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. Simplified14.2

      \[\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-sqrt14.2

      \[\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)}^{y.re}} \cdot 1\]
    7. Applied associate-/l*14.2

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

      \[\leadsto \frac{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}{\frac{{\left(\frac{1}{x.re}\right)}^{y.re}}{\sqrt{\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}}}}}} \cdot 1\]
    10. Applied sqrt-prod14.2

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

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

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

      \[\leadsto \frac{\sqrt{\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}}}}}{\frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}} \cdot \frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}} \cdot 1\]
    14. Applied sqrt-prod14.2

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

      \[\leadsto \color{blue}{\left(\frac{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{\frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}} \cdot \frac{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}{\frac{\sqrt{{\left(\frac{1}{x.re}\right)}^{y.re}}}{\sqrt{\sqrt{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}}}\right)} \cdot 1\]
  3. Recombined 3 regimes into one program.
  4. Final simplification11.2

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

Reproduce

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