Average Error: 33.2 → 9.0
Time: 27.7s
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 2.009377008199938906346016128259715825559 \cdot 10^{-310}:\\ \;\;\;\;e^{\left(-\log \left(\frac{-1}{x.re}\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.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 2.009377008199938906346016128259715825559 \cdot 10^{-310}:\\
\;\;\;\;e^{\left(-\log \left(\frac{-1}{x.re}\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.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 r31317 = x_re;
        double r31318 = r31317 * r31317;
        double r31319 = x_im;
        double r31320 = r31319 * r31319;
        double r31321 = r31318 + r31320;
        double r31322 = sqrt(r31321);
        double r31323 = log(r31322);
        double r31324 = y_re;
        double r31325 = r31323 * r31324;
        double r31326 = atan2(r31319, r31317);
        double r31327 = y_im;
        double r31328 = r31326 * r31327;
        double r31329 = r31325 - r31328;
        double r31330 = exp(r31329);
        double r31331 = r31323 * r31327;
        double r31332 = r31326 * r31324;
        double r31333 = r31331 + r31332;
        double r31334 = cos(r31333);
        double r31335 = r31330 * r31334;
        return r31335;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r31336 = x_re;
        double r31337 = 2.00937700819994e-310;
        bool r31338 = r31336 <= r31337;
        double r31339 = -1.0;
        double r31340 = r31339 / r31336;
        double r31341 = log(r31340);
        double r31342 = -r31341;
        double r31343 = y_re;
        double r31344 = r31342 * r31343;
        double r31345 = x_im;
        double r31346 = atan2(r31345, r31336);
        double r31347 = y_im;
        double r31348 = r31346 * r31347;
        double r31349 = r31344 - r31348;
        double r31350 = exp(r31349);
        double r31351 = log(r31336);
        double r31352 = r31343 * r31351;
        double r31353 = r31352 - r31348;
        double r31354 = exp(r31353);
        double r31355 = r31338 ? r31350 : r31354;
        return r31355;
}

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 < 2.00937700819994e-310

    1. Initial program 31.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 17.7

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

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

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

    if 2.00937700819994e-310 < x.re

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

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

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

Reproduce

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