Average Error: 33.2 → 11.2
Time: 7.4s
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.3446615524165113 \cdot 10^{154}:\\ \;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) + \log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right)} \cdot 1\\ \mathbf{elif}\;x.re \le -2.14264910082910267 \cdot 10^{-57}:\\ \;\;\;\;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{elif}\;x.re \le -3.483126227749789 \cdot 10^{-310}:\\ \;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) + \log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\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 -1.3446615524165113 \cdot 10^{154}:\\
\;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) + \log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right)} \cdot 1\\

\mathbf{elif}\;x.re \le -2.14264910082910267 \cdot 10^{-57}:\\
\;\;\;\;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{elif}\;x.re \le -3.483126227749789 \cdot 10^{-310}:\\
\;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) + \log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\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 r13324 = x_re;
        double r13325 = r13324 * r13324;
        double r13326 = x_im;
        double r13327 = r13326 * r13326;
        double r13328 = r13325 + r13327;
        double r13329 = sqrt(r13328);
        double r13330 = log(r13329);
        double r13331 = y_re;
        double r13332 = r13330 * r13331;
        double r13333 = atan2(r13326, r13324);
        double r13334 = y_im;
        double r13335 = r13333 * r13334;
        double r13336 = r13332 - r13335;
        double r13337 = exp(r13336);
        double r13338 = r13330 * r13334;
        double r13339 = r13333 * r13331;
        double r13340 = r13338 + r13339;
        double r13341 = cos(r13340);
        double r13342 = r13337 * r13341;
        return r13342;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r13343 = x_re;
        double r13344 = -1.3446615524165113e+154;
        bool r13345 = r13343 <= r13344;
        double r13346 = x_im;
        double r13347 = atan2(r13346, r13343);
        double r13348 = y_im;
        double r13349 = r13347 * r13348;
        double r13350 = -r13349;
        double r13351 = exp(r13350);
        double r13352 = -1.0;
        double r13353 = r13352 / r13343;
        double r13354 = y_re;
        double r13355 = pow(r13353, r13354);
        double r13356 = exp(r13355);
        double r13357 = sqrt(r13356);
        double r13358 = log(r13357);
        double r13359 = r13358 + r13358;
        double r13360 = r13351 / r13359;
        double r13361 = 1.0;
        double r13362 = r13360 * r13361;
        double r13363 = -2.1426491008291027e-57;
        bool r13364 = r13343 <= r13363;
        double r13365 = r13343 * r13343;
        double r13366 = r13346 * r13346;
        double r13367 = r13365 + r13366;
        double r13368 = sqrt(r13367);
        double r13369 = log(r13368);
        double r13370 = r13369 * r13354;
        double r13371 = r13370 - r13349;
        double r13372 = exp(r13371);
        double r13373 = r13372 * r13361;
        double r13374 = -3.4831262277498e-310;
        bool r13375 = r13343 <= r13374;
        double r13376 = log(r13343);
        double r13377 = r13376 * r13354;
        double r13378 = r13377 - r13349;
        double r13379 = exp(r13378);
        double r13380 = r13379 * r13361;
        double r13381 = r13375 ? r13362 : r13380;
        double r13382 = r13364 ? r13373 : r13381;
        double r13383 = r13345 ? r13362 : r13382;
        return r13383;
}

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 < -1.3446615524165113e+154 or -2.1426491008291027e-57 < x.re < -3.4831262277498e-310

    1. Initial program 40.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 22.3

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

      \[\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{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}}} \cdot 1\]
    5. Using strategy rm
    6. Applied add-log-exp11.9

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

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

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

    if -1.3446615524165113e+154 < x.re < -2.1426491008291027e-57

    1. Initial program 15.7

      \[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 8.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}\]

    if -3.4831262277498e-310 < x.re

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -1.3446615524165113 \cdot 10^{154}:\\ \;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) + \log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right)} \cdot 1\\ \mathbf{elif}\;x.re \le -2.14264910082910267 \cdot 10^{-57}:\\ \;\;\;\;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{elif}\;x.re \le -3.483126227749789 \cdot 10^{-310}:\\ \;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{\log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\right) + \log \left(\sqrt{e^{{\left(\frac{-1}{x.re}\right)}^{y.re}}}\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 2020065 
(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)))))