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

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r662240 = x_re;
        double r662241 = r662240 * r662240;
        double r662242 = x_im;
        double r662243 = r662242 * r662242;
        double r662244 = r662241 + r662243;
        double r662245 = sqrt(r662244);
        double r662246 = log(r662245);
        double r662247 = y_re;
        double r662248 = r662246 * r662247;
        double r662249 = atan2(r662242, r662240);
        double r662250 = y_im;
        double r662251 = r662249 * r662250;
        double r662252 = r662248 - r662251;
        double r662253 = exp(r662252);
        double r662254 = r662246 * r662250;
        double r662255 = r662249 * r662247;
        double r662256 = r662254 + r662255;
        double r662257 = cos(r662256);
        double r662258 = r662253 * r662257;
        return r662258;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r662259 = x_re;
        double r662260 = -1.7421973940893e-310;
        bool r662261 = r662259 <= r662260;
        double r662262 = -r662259;
        double r662263 = log(r662262);
        double r662264 = y_re;
        double r662265 = r662263 * r662264;
        double r662266 = y_im;
        double r662267 = x_im;
        double r662268 = atan2(r662267, r662259);
        double r662269 = r662266 * r662268;
        double r662270 = r662265 - r662269;
        double r662271 = exp(r662270);
        double r662272 = log(r662259);
        double r662273 = r662272 * r662264;
        double r662274 = r662273 - r662269;
        double r662275 = exp(r662274);
        double r662276 = r662261 ? r662271 : r662275;
        return r662276;
}

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.7421973940893e-310

    1. Initial program 30.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 16.6

      \[\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 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. Simplified5.9

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

    if -1.7421973940893e-310 < x.re

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

      \[\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. Simplified11.5

      \[\leadsto e^{\color{blue}{\log 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 simplification8.9

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

Reproduce

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