Average Error: 33.0 → 9.1
Time: 27.2s
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 -2.203136696212098368153966931412365744688 \cdot 10^{-306}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{elif}\;x.re \le 2.354070740496083302526100857388941057602 \cdot 10^{-92}:\\ \;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{elif}\;x.re \le 0.03393766374877916353058893150773656088859:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt[3]{\sqrt{x.im \cdot x.im + x.re \cdot x.re} \cdot \left(x.im \cdot x.im + x.re \cdot x.re\right)}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \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 -2.203136696212098368153966931412365744688 \cdot 10^{-306}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

\mathbf{elif}\;x.re \le 2.354070740496083302526100857388941057602 \cdot 10^{-92}:\\
\;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

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

\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1430788 = x_re;
        double r1430789 = r1430788 * r1430788;
        double r1430790 = x_im;
        double r1430791 = r1430790 * r1430790;
        double r1430792 = r1430789 + r1430791;
        double r1430793 = sqrt(r1430792);
        double r1430794 = log(r1430793);
        double r1430795 = y_re;
        double r1430796 = r1430794 * r1430795;
        double r1430797 = atan2(r1430790, r1430788);
        double r1430798 = y_im;
        double r1430799 = r1430797 * r1430798;
        double r1430800 = r1430796 - r1430799;
        double r1430801 = exp(r1430800);
        double r1430802 = r1430794 * r1430798;
        double r1430803 = r1430797 * r1430795;
        double r1430804 = r1430802 + r1430803;
        double r1430805 = cos(r1430804);
        double r1430806 = r1430801 * r1430805;
        return r1430806;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1430807 = x_re;
        double r1430808 = -2.2031366962120984e-306;
        bool r1430809 = r1430807 <= r1430808;
        double r1430810 = -r1430807;
        double r1430811 = log(r1430810);
        double r1430812 = y_re;
        double r1430813 = r1430811 * r1430812;
        double r1430814 = y_im;
        double r1430815 = x_im;
        double r1430816 = atan2(r1430815, r1430807);
        double r1430817 = r1430814 * r1430816;
        double r1430818 = r1430813 - r1430817;
        double r1430819 = exp(r1430818);
        double r1430820 = 2.3540707404960833e-92;
        bool r1430821 = r1430807 <= r1430820;
        double r1430822 = log(r1430807);
        double r1430823 = r1430812 * r1430822;
        double r1430824 = r1430823 - r1430817;
        double r1430825 = exp(r1430824);
        double r1430826 = 0.033937663748779164;
        bool r1430827 = r1430807 <= r1430826;
        double r1430828 = r1430815 * r1430815;
        double r1430829 = r1430807 * r1430807;
        double r1430830 = r1430828 + r1430829;
        double r1430831 = sqrt(r1430830);
        double r1430832 = r1430831 * r1430830;
        double r1430833 = cbrt(r1430832);
        double r1430834 = log(r1430833);
        double r1430835 = r1430812 * r1430834;
        double r1430836 = r1430835 - r1430817;
        double r1430837 = exp(r1430836);
        double r1430838 = r1430827 ? r1430837 : r1430825;
        double r1430839 = r1430821 ? r1430825 : r1430838;
        double r1430840 = r1430809 ? r1430819 : r1430839;
        return r1430840;
}

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 < -2.2031366962120984e-306

    1. Initial program 31.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 17.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 5.9

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

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

    if -2.2031366962120984e-306 < x.re < 2.3540707404960833e-92 or 0.033937663748779164 < x.re

    1. Initial program 36.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 22.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 11.5

      \[\leadsto e^{\log \color{blue}{x.re} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]

    if 2.3540707404960833e-92 < x.re < 0.033937663748779164

    1. Initial program 19.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 12.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-cbrt-cube15.8

      \[\leadsto e^{\log \color{blue}{\left(\sqrt[3]{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im} \cdot \sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot \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\]
    5. Simplified15.8

      \[\leadsto e^{\log \left(\sqrt[3]{\color{blue}{\sqrt{x.re \cdot x.re + x.im \cdot x.im} \cdot \left(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\]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -2.203136696212098368153966931412365744688 \cdot 10^{-306}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{elif}\;x.re \le 2.354070740496083302526100857388941057602 \cdot 10^{-92}:\\ \;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{elif}\;x.re \le 0.03393766374877916353058893150773656088859:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt[3]{\sqrt{x.im \cdot x.im + x.re \cdot x.re} \cdot \left(x.im \cdot x.im + x.re \cdot x.re\right)}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  (* (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)))))