Average Error: 33.6 → 9.1
Time: 24.2s
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.139329358485260398678701659639633596924 \cdot 10^{-311}:\\ \;\;\;\;e^{\left(\log \left(\frac{-1}{x.re}\right) \cdot \sqrt[3]{-y.re}\right) \cdot \left(\sqrt[3]{-y.re} \cdot \sqrt[3]{-y.re}\right) - 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 2.139329358485260398678701659639633596924 \cdot 10^{-311}:\\
\;\;\;\;e^{\left(\log \left(\frac{-1}{x.re}\right) \cdot \sqrt[3]{-y.re}\right) \cdot \left(\sqrt[3]{-y.re} \cdot \sqrt[3]{-y.re}\right) - 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 r23239 = x_re;
        double r23240 = r23239 * r23239;
        double r23241 = x_im;
        double r23242 = r23241 * r23241;
        double r23243 = r23240 + r23242;
        double r23244 = sqrt(r23243);
        double r23245 = log(r23244);
        double r23246 = y_re;
        double r23247 = r23245 * r23246;
        double r23248 = atan2(r23241, r23239);
        double r23249 = y_im;
        double r23250 = r23248 * r23249;
        double r23251 = r23247 - r23250;
        double r23252 = exp(r23251);
        double r23253 = r23245 * r23249;
        double r23254 = r23248 * r23246;
        double r23255 = r23253 + r23254;
        double r23256 = cos(r23255);
        double r23257 = r23252 * r23256;
        return r23257;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r23258 = x_re;
        double r23259 = 2.1393293584853e-311;
        bool r23260 = r23258 <= r23259;
        double r23261 = -1.0;
        double r23262 = r23261 / r23258;
        double r23263 = log(r23262);
        double r23264 = y_re;
        double r23265 = -r23264;
        double r23266 = cbrt(r23265);
        double r23267 = r23263 * r23266;
        double r23268 = r23266 * r23266;
        double r23269 = r23267 * r23268;
        double r23270 = y_im;
        double r23271 = x_im;
        double r23272 = atan2(r23271, r23258);
        double r23273 = r23270 * r23272;
        double r23274 = r23269 - r23273;
        double r23275 = exp(r23274);
        double r23276 = log(r23258);
        double r23277 = r23276 * r23264;
        double r23278 = r23277 - r23273;
        double r23279 = exp(r23278);
        double r23280 = r23260 ? r23275 : r23279;
        return r23280;
}

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.1393293584853e-311

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

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

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

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

    if 2.1393293584853e-311 < x.re

    1. Initial program 35.1

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

      \[\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 2.139329358485260398678701659639633596924 \cdot 10^{-311}:\\ \;\;\;\;e^{\left(\log \left(\frac{-1}{x.re}\right) \cdot \sqrt[3]{-y.re}\right) \cdot \left(\sqrt[3]{-y.re} \cdot \sqrt[3]{-y.re}\right) - 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 2019196 
(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)))))