Average Error: 33.8 → 9.3
Time: 16.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 -1.99303880436604133 \cdot 10^{-80}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le 2.986375179024046 \cdot 10^{-310} \lor \neg \left(x.re \le 8.899433436760234 \cdot 10^{-153}\right) \land x.re \le 5.92453119316243509 \cdot 10^{-30}:\\ \;\;\;\;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}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \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.99303880436604133 \cdot 10^{-80}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{elif}\;x.re \le 2.986375179024046 \cdot 10^{-310} \lor \neg \left(x.re \le 8.899433436760234 \cdot 10^{-153}\right) \land x.re \le 5.92453119316243509 \cdot 10^{-30}:\\
\;\;\;\;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}\\

\mathbf{else}:\\
\;\;\;\;e^{\log x.re \cdot y.re - \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 r14552 = x_re;
        double r14553 = r14552 * r14552;
        double r14554 = x_im;
        double r14555 = r14554 * r14554;
        double r14556 = r14553 + r14555;
        double r14557 = sqrt(r14556);
        double r14558 = log(r14557);
        double r14559 = y_re;
        double r14560 = r14558 * r14559;
        double r14561 = atan2(r14554, r14552);
        double r14562 = y_im;
        double r14563 = r14561 * r14562;
        double r14564 = r14560 - r14563;
        double r14565 = exp(r14564);
        double r14566 = r14558 * r14562;
        double r14567 = r14561 * r14559;
        double r14568 = r14566 + r14567;
        double r14569 = cos(r14568);
        double r14570 = r14565 * r14569;
        return r14570;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14571 = x_re;
        double r14572 = -1.9930388043660413e-80;
        bool r14573 = r14571 <= r14572;
        double r14574 = -r14571;
        double r14575 = log(r14574);
        double r14576 = y_re;
        double r14577 = r14575 * r14576;
        double r14578 = x_im;
        double r14579 = atan2(r14578, r14571);
        double r14580 = y_im;
        double r14581 = r14579 * r14580;
        double r14582 = r14577 - r14581;
        double r14583 = exp(r14582);
        double r14584 = 2.98637517902405e-310;
        bool r14585 = r14571 <= r14584;
        double r14586 = 8.899433436760234e-153;
        bool r14587 = r14571 <= r14586;
        double r14588 = !r14587;
        double r14589 = 5.924531193162435e-30;
        bool r14590 = r14571 <= r14589;
        bool r14591 = r14588 && r14590;
        bool r14592 = r14585 || r14591;
        double r14593 = r14571 * r14571;
        double r14594 = r14578 * r14578;
        double r14595 = r14593 + r14594;
        double r14596 = sqrt(r14595);
        double r14597 = log(r14596);
        double r14598 = r14597 * r14576;
        double r14599 = r14598 - r14581;
        double r14600 = exp(r14599);
        double r14601 = log(r14571);
        double r14602 = r14601 * r14576;
        double r14603 = r14602 - r14581;
        double r14604 = exp(r14603);
        double r14605 = r14592 ? r14600 : r14604;
        double r14606 = r14573 ? r14583 : r14605;
        return r14606;
}

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 < -1.9930388043660413e-80

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

      \[\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.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. Simplified2.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 -1.9930388043660413e-80 < x.re < 2.98637517902405e-310 or 8.899433436760234e-153 < x.re < 5.924531193162435e-30

    1. Initial program 23.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 13.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}\]

    if 2.98637517902405e-310 < x.re < 8.899433436760234e-153 or 5.924531193162435e-30 < x.re

    1. Initial program 39.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 24.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.5

      \[\leadsto e^{\log \color{blue}{x.re} \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.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -1.99303880436604133 \cdot 10^{-80}:\\ \;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le 2.986375179024046 \cdot 10^{-310} \lor \neg \left(x.re \le 8.899433436760234 \cdot 10^{-153}\right) \land x.re \le 5.92453119316243509 \cdot 10^{-30}:\\ \;\;\;\;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}\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Reproduce

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