Average Error: 33.3 → 11.7
Time: 17.1s
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.834082490610377860702173305231422830906 \cdot 10^{-302}:\\ \;\;\;\;{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{-2}\right)} \cdot \log \left(e^{\frac{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{-2}\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\right)\\ \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.834082490610377860702173305231422830906 \cdot 10^{-302}:\\
\;\;\;\;{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{-2}\right)} \cdot \log \left(e^{\frac{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{-2}\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\right)\\

\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 r15637 = x_re;
        double r15638 = r15637 * r15637;
        double r15639 = x_im;
        double r15640 = r15639 * r15639;
        double r15641 = r15638 + r15640;
        double r15642 = sqrt(r15641);
        double r15643 = log(r15642);
        double r15644 = y_re;
        double r15645 = r15643 * r15644;
        double r15646 = atan2(r15639, r15637);
        double r15647 = y_im;
        double r15648 = r15646 * r15647;
        double r15649 = r15645 - r15648;
        double r15650 = exp(r15649);
        double r15651 = r15643 * r15647;
        double r15652 = r15646 * r15644;
        double r15653 = r15651 + r15652;
        double r15654 = cos(r15653);
        double r15655 = r15650 * r15654;
        return r15655;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r15656 = x_re;
        double r15657 = -1.8340824906103779e-302;
        bool r15658 = r15656 <= r15657;
        double r15659 = -1.0;
        double r15660 = r15659 / r15656;
        double r15661 = y_re;
        double r15662 = -2.0;
        double r15663 = r15661 / r15662;
        double r15664 = pow(r15660, r15663);
        double r15665 = x_im;
        double r15666 = atan2(r15665, r15656);
        double r15667 = y_im;
        double r15668 = r15666 * r15667;
        double r15669 = exp(r15668);
        double r15670 = r15664 / r15669;
        double r15671 = exp(r15670);
        double r15672 = log(r15671);
        double r15673 = r15664 * r15672;
        double r15674 = log(r15656);
        double r15675 = r15674 * r15661;
        double r15676 = r15675 - r15668;
        double r15677 = exp(r15676);
        double r15678 = r15658 ? r15673 : r15677;
        return r15678;
}

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.8340824906103779e-302

    1. Initial program 32.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 17.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 5.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.9

      \[\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 *-un-lft-identity11.9

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

      \[\leadsto \frac{\color{blue}{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{-y.re}{2}\right)} \cdot {\left(\frac{-1}{x.re}\right)}^{\left(\frac{-y.re}{2}\right)}}}{1 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot 1\]
    8. Applied times-frac11.9

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

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

      \[\leadsto \left({\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{-2}\right)} \cdot \color{blue}{\frac{{\left(\frac{-1}{x.re}\right)}^{\left(\frac{y.re}{-2}\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\right) \cdot 1\]
    11. Using strategy rm
    12. Applied add-log-exp11.9

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

    if -1.8340824906103779e-302 < x.re

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

      \[\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 e^{\log \color{blue}{x.re} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.7

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