Average Error: 32.8 → 10.5
Time: 8.9s
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 -4.50551102600696963 \cdot 10^{-229}:\\ \;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \mathbf{elif}\;x.re \le 1662515902.0527577:\\ \;\;\;\;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}:\\ \;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{1}{x.re}\right)}^{y.re}} \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 -4.50551102600696963 \cdot 10^{-229}:\\
\;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\

\mathbf{elif}\;x.re \le 1662515902.0527577:\\
\;\;\;\;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}:\\
\;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{1}{x.re}\right)}^{y.re}} \cdot 1\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r14608 = x_re;
        double r14609 = r14608 * r14608;
        double r14610 = x_im;
        double r14611 = r14610 * r14610;
        double r14612 = r14609 + r14611;
        double r14613 = sqrt(r14612);
        double r14614 = log(r14613);
        double r14615 = y_re;
        double r14616 = r14614 * r14615;
        double r14617 = atan2(r14610, r14608);
        double r14618 = y_im;
        double r14619 = r14617 * r14618;
        double r14620 = r14616 - r14619;
        double r14621 = exp(r14620);
        double r14622 = r14614 * r14618;
        double r14623 = r14617 * r14615;
        double r14624 = r14622 + r14623;
        double r14625 = cos(r14624);
        double r14626 = r14621 * r14625;
        return r14626;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14627 = x_re;
        double r14628 = -4.5055110260069696e-229;
        bool r14629 = r14627 <= r14628;
        double r14630 = -1.0;
        double r14631 = r14630 * r14627;
        double r14632 = log(r14631);
        double r14633 = y_re;
        double r14634 = r14632 * r14633;
        double r14635 = x_im;
        double r14636 = atan2(r14635, r14627);
        double r14637 = y_im;
        double r14638 = r14636 * r14637;
        double r14639 = r14634 - r14638;
        double r14640 = exp(r14639);
        double r14641 = 1.0;
        double r14642 = r14640 * r14641;
        double r14643 = 1662515902.0527577;
        bool r14644 = r14627 <= r14643;
        double r14645 = r14627 * r14627;
        double r14646 = r14635 * r14635;
        double r14647 = r14645 + r14646;
        double r14648 = sqrt(r14647);
        double r14649 = log(r14648);
        double r14650 = r14649 * r14633;
        double r14651 = r14650 - r14638;
        double r14652 = exp(r14651);
        double r14653 = r14652 * r14641;
        double r14654 = -r14638;
        double r14655 = exp(r14654);
        double r14656 = r14641 / r14627;
        double r14657 = pow(r14656, r14633);
        double r14658 = r14655 / r14657;
        double r14659 = r14658 * r14641;
        double r14660 = r14644 ? r14653 : r14659;
        double r14661 = r14629 ? r14642 : r14660;
        return r14661;
}

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 < -4.5055110260069696e-229

    1. Initial program 31.9

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

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

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

    if -4.5055110260069696e-229 < x.re < 1662515902.0527577

    1. Initial program 24.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. 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 1662515902.0527577 < x.re

    1. Initial program 44.9

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

      \[\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\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.5

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

Reproduce

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