Average Error: 30.7 → 0.2
Time: 2.6m
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}\;y.re \le -2.8254894938573524 \cdot 10^{-11}:\\ \;\;\;\;e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \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}\;y.re \le -2.8254894938573524 \cdot 10^{-11}:\\
\;\;\;\;e^{\log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \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 r1174389 = x_re;
        double r1174390 = r1174389 * r1174389;
        double r1174391 = x_im;
        double r1174392 = r1174391 * r1174391;
        double r1174393 = r1174390 + r1174392;
        double r1174394 = sqrt(r1174393);
        double r1174395 = log(r1174394);
        double r1174396 = y_re;
        double r1174397 = r1174395 * r1174396;
        double r1174398 = atan2(r1174391, r1174389);
        double r1174399 = y_im;
        double r1174400 = r1174398 * r1174399;
        double r1174401 = r1174397 - r1174400;
        double r1174402 = exp(r1174401);
        double r1174403 = r1174395 * r1174399;
        double r1174404 = r1174398 * r1174396;
        double r1174405 = r1174403 + r1174404;
        double r1174406 = cos(r1174405);
        double r1174407 = r1174402 * r1174406;
        return r1174407;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1174408 = y_re;
        double r1174409 = -2.8254894938573524e-11;
        bool r1174410 = r1174408 <= r1174409;
        double r1174411 = x_im;
        double r1174412 = r1174411 * r1174411;
        double r1174413 = x_re;
        double r1174414 = r1174413 * r1174413;
        double r1174415 = r1174412 + r1174414;
        double r1174416 = sqrt(r1174415);
        double r1174417 = log(r1174416);
        double r1174418 = r1174417 * r1174408;
        double r1174419 = atan2(r1174411, r1174413);
        double r1174420 = y_im;
        double r1174421 = r1174419 * r1174420;
        double r1174422 = r1174418 - r1174421;
        double r1174423 = exp(r1174422);
        double r1174424 = -r1174413;
        double r1174425 = log(r1174424);
        double r1174426 = r1174408 * r1174425;
        double r1174427 = r1174426 - r1174421;
        double r1174428 = exp(r1174427);
        double r1174429 = r1174410 ? r1174423 : r1174428;
        return r1174429;
}

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 y.re < -2.8254894938573524e-11

    1. Initial program 36.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 0.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}\]

    if -2.8254894938573524e-11 < y.re

    1. Initial program 27.8

      \[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 25.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 0.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. Simplified0.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\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.2

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

Reproduce

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