Average Error: 33.1 → 14.2
Time: 13.4s
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[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}} \cdot \sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\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 -3.32385463119362289 \cdot 10^{-304}:\\ \;\;\;\;\frac{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}} \cdot \sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}}}\\ \mathbf{elif}\;x.re \le 1.8132444825100107 \cdot 10^{-270}:\\ \;\;\;\;e^{\log \left(\log \left(e^{\sqrt{x.re \cdot x.re + x.im \cdot x.im}}\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{{x.re}^{y.re}}{e^{\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[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}} \cdot \sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\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 -3.32385463119362289 \cdot 10^{-304}:\\
\;\;\;\;\frac{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}} \cdot \sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{{x.re}^{y.re}}{e^{\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 r14735 = x_re;
        double r14736 = r14735 * r14735;
        double r14737 = x_im;
        double r14738 = r14737 * r14737;
        double r14739 = r14736 + r14738;
        double r14740 = sqrt(r14739);
        double r14741 = log(r14740);
        double r14742 = y_re;
        double r14743 = r14741 * r14742;
        double r14744 = atan2(r14737, r14735);
        double r14745 = y_im;
        double r14746 = r14744 * r14745;
        double r14747 = r14743 - r14746;
        double r14748 = exp(r14747);
        double r14749 = r14741 * r14745;
        double r14750 = r14744 * r14742;
        double r14751 = r14749 + r14750;
        double r14752 = cos(r14751);
        double r14753 = r14748 * r14752;
        return r14753;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14754 = x_re;
        double r14755 = -1.669808635902091e+152;
        bool r14756 = r14754 <= r14755;
        double r14757 = -1.0;
        double r14758 = r14757 / r14754;
        double r14759 = y_re;
        double r14760 = -r14759;
        double r14761 = pow(r14758, r14760);
        double r14762 = cbrt(r14761);
        double r14763 = r14762 * r14762;
        double r14764 = x_im;
        double r14765 = atan2(r14764, r14754);
        double r14766 = y_im;
        double r14767 = r14765 * r14766;
        double r14768 = exp(r14767);
        double r14769 = r14768 / r14762;
        double r14770 = r14763 / r14769;
        double r14771 = -1.5993696563270364e+57;
        bool r14772 = r14754 <= r14771;
        double r14773 = r14754 * r14754;
        double r14774 = r14764 * r14764;
        double r14775 = r14773 + r14774;
        double r14776 = sqrt(r14775);
        double r14777 = log(r14776);
        double r14778 = r14777 * r14759;
        double r14779 = r14778 - r14767;
        double r14780 = exp(r14779);
        double r14781 = r14777 * r14766;
        double r14782 = r14765 * r14759;
        double r14783 = r14781 + r14782;
        double r14784 = cos(r14783);
        double r14785 = 3.0;
        double r14786 = pow(r14784, r14785);
        double r14787 = cbrt(r14786);
        double r14788 = r14780 * r14787;
        double r14789 = -3.323854631193623e-304;
        bool r14790 = r14754 <= r14789;
        double r14791 = 1.8132444825100107e-270;
        bool r14792 = r14754 <= r14791;
        double r14793 = exp(r14776);
        double r14794 = log(r14793);
        double r14795 = log(r14794);
        double r14796 = r14795 * r14759;
        double r14797 = r14796 - r14767;
        double r14798 = exp(r14797);
        double r14799 = pow(r14754, r14759);
        double r14800 = r14799 / r14768;
        double r14801 = r14792 ? r14798 : r14800;
        double r14802 = r14790 ? r14770 : r14801;
        double r14803 = r14772 ? r14788 : r14802;
        double r14804 = r14756 ? r14770 : r14803;
        return r14804;
}

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

    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.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 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{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot 1\]
    5. Using strategy rm
    6. Applied add-cube-cbrt11.7

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}} \cdot \sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}}{\frac{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\sqrt[3]{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\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 -3.323854631193623e-304 < x.re < 1.8132444825100107e-270

    1. Initial program 30.7

      \[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.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. Using strategy rm
    4. Applied add-log-exp33.7

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

    if 1.8132444825100107e-270 < x.re

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

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

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

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

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