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

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r24945 = x_re;
        double r24946 = r24945 * r24945;
        double r24947 = x_im;
        double r24948 = r24947 * r24947;
        double r24949 = r24946 + r24948;
        double r24950 = sqrt(r24949);
        double r24951 = log(r24950);
        double r24952 = y_re;
        double r24953 = r24951 * r24952;
        double r24954 = atan2(r24947, r24945);
        double r24955 = y_im;
        double r24956 = r24954 * r24955;
        double r24957 = r24953 - r24956;
        double r24958 = exp(r24957);
        double r24959 = r24951 * r24955;
        double r24960 = r24954 * r24952;
        double r24961 = r24959 + r24960;
        double r24962 = cos(r24961);
        double r24963 = r24958 * r24962;
        return r24963;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r24964 = x_re;
        double r24965 = -3.6252543666988e-312;
        bool r24966 = r24964 <= r24965;
        double r24967 = -1.0;
        double r24968 = y_re;
        double r24969 = r24967 / r24964;
        double r24970 = log(r24969);
        double r24971 = r24968 * r24970;
        double r24972 = r24967 * r24971;
        double r24973 = x_im;
        double r24974 = atan2(r24973, r24964);
        double r24975 = y_im;
        double r24976 = r24974 * r24975;
        double r24977 = r24972 - r24976;
        double r24978 = exp(r24977);
        double r24979 = exp(r24978);
        double r24980 = log(r24979);
        double r24981 = 1.0;
        double r24982 = r24980 * r24981;
        double r24983 = log(r24964);
        double r24984 = r24983 * r24968;
        double r24985 = r24984 - r24976;
        double r24986 = exp(r24985);
        double r24987 = r24986 * r24981;
        double r24988 = r24966 ? r24982 : r24987;
        return r24988;
}

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 < -3.6252543666988e-312

    1. Initial program 32.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 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.8

      \[\leadsto e^{\color{blue}{-1 \cdot \left(y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    4. Using strategy rm
    5. Applied add-log-exp5.8

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

    if -3.6252543666988e-312 < x.re

    1. Initial program 35.0

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

      \[\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 simplification9.1

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

Reproduce

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