Average Error: 32.8 → 3.9
Time: 8.0s
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)\]
\[e^{\sqrt[3]{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)\right)}^{3}\right)\right)}}\]
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)
e^{\sqrt[3]{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)\right)}^{3}\right)\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r18366 = x_re;
        double r18367 = r18366 * r18366;
        double r18368 = x_im;
        double r18369 = r18368 * r18368;
        double r18370 = r18367 + r18369;
        double r18371 = sqrt(r18370);
        double r18372 = log(r18371);
        double r18373 = y_re;
        double r18374 = r18372 * r18373;
        double r18375 = atan2(r18368, r18366);
        double r18376 = y_im;
        double r18377 = r18375 * r18376;
        double r18378 = r18374 - r18377;
        double r18379 = exp(r18378);
        double r18380 = r18372 * r18376;
        double r18381 = r18375 * r18373;
        double r18382 = r18380 + r18381;
        double r18383 = cos(r18382);
        double r18384 = r18379 * r18383;
        return r18384;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r18385 = y_re;
        double r18386 = x_re;
        double r18387 = x_im;
        double r18388 = hypot(r18386, r18387);
        double r18389 = log(r18388);
        double r18390 = atan2(r18387, r18386);
        double r18391 = y_im;
        double r18392 = r18390 * r18391;
        double r18393 = -r18392;
        double r18394 = fma(r18385, r18389, r18393);
        double r18395 = 3.0;
        double r18396 = pow(r18394, r18395);
        double r18397 = expm1(r18396);
        double r18398 = log1p(r18397);
        double r18399 = cbrt(r18398);
        double r18400 = exp(r18399);
        return r18400;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 32.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 19.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. Using strategy rm
  4. Applied add-cbrt-cube19.4

    \[\leadsto e^{\color{blue}{\sqrt[3]{\left(\left(\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\right) \cdot \left(\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\right)\right) \cdot \left(\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\right)}}} \cdot 1\]
  5. Simplified3.8

    \[\leadsto e^{\sqrt[3]{\color{blue}{{\left(\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)\right)}^{3}}}} \cdot 1\]
  6. Using strategy rm
  7. Applied log1p-expm1-u3.9

    \[\leadsto e^{\sqrt[3]{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)\right)}^{3}\right)\right)}}} \cdot 1\]
  8. Final simplification3.9

    \[\leadsto e^{\sqrt[3]{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)\right)}^{3}\right)\right)}}\]

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(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)))))