Average Error: 32.7 → 9.1
Time: 29.7s
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.2253344719312 \cdot 10^{-312}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.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 -1.2253344719312 \cdot 10^{-312}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\

\mathbf{else}:\\
\;\;\;\;e^{\log x.re \cdot y.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 r1447773 = x_re;
        double r1447774 = r1447773 * r1447773;
        double r1447775 = x_im;
        double r1447776 = r1447775 * r1447775;
        double r1447777 = r1447774 + r1447776;
        double r1447778 = sqrt(r1447777);
        double r1447779 = log(r1447778);
        double r1447780 = y_re;
        double r1447781 = r1447779 * r1447780;
        double r1447782 = atan2(r1447775, r1447773);
        double r1447783 = y_im;
        double r1447784 = r1447782 * r1447783;
        double r1447785 = r1447781 - r1447784;
        double r1447786 = exp(r1447785);
        double r1447787 = r1447779 * r1447783;
        double r1447788 = r1447782 * r1447780;
        double r1447789 = r1447787 + r1447788;
        double r1447790 = cos(r1447789);
        double r1447791 = r1447786 * r1447790;
        return r1447791;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1447792 = x_re;
        double r1447793 = -1.2253344719312e-312;
        bool r1447794 = r1447792 <= r1447793;
        double r1447795 = -r1447792;
        double r1447796 = log(r1447795);
        double r1447797 = y_re;
        double r1447798 = r1447796 * r1447797;
        double r1447799 = y_im;
        double r1447800 = x_im;
        double r1447801 = atan2(r1447800, r1447792);
        double r1447802 = r1447799 * r1447801;
        double r1447803 = r1447798 - r1447802;
        double r1447804 = exp(r1447803);
        double r1447805 = log(r1447792);
        double r1447806 = r1447805 * r1447797;
        double r1447807 = r1447806 - r1447802;
        double r1447808 = exp(r1447807);
        double r1447809 = r1447794 ? r1447804 : r1447808;
        return r1447809;
}

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 2 regimes
  2. if x.re < -1.2253344719312e-312

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

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

      \[\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 -1.2253344719312e-312 < x.re

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -1.2253344719312 \cdot 10^{-312}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \end{array}\]

Reproduce

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