Average Error: 32.5 → 3.4
Time: 31.9s
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^{\left(y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot y.re\right)\right)\right)\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^{\left(y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot y.re\right)\right)\right)\right)\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r741268 = x_re;
        double r741269 = r741268 * r741268;
        double r741270 = x_im;
        double r741271 = r741270 * r741270;
        double r741272 = r741269 + r741271;
        double r741273 = sqrt(r741272);
        double r741274 = log(r741273);
        double r741275 = y_re;
        double r741276 = r741274 * r741275;
        double r741277 = atan2(r741270, r741268);
        double r741278 = y_im;
        double r741279 = r741277 * r741278;
        double r741280 = r741276 - r741279;
        double r741281 = exp(r741280);
        double r741282 = r741274 * r741278;
        double r741283 = r741277 * r741275;
        double r741284 = r741282 + r741283;
        double r741285 = cos(r741284);
        double r741286 = r741281 * r741285;
        return r741286;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r741287 = y_re;
        double r741288 = x_re;
        double r741289 = x_im;
        double r741290 = hypot(r741288, r741289);
        double r741291 = cbrt(r741290);
        double r741292 = log(r741291);
        double r741293 = r741287 * r741292;
        double r741294 = r741291 * r741291;
        double r741295 = log(r741294);
        double r741296 = r741295 * r741287;
        double r741297 = r741293 + r741296;
        double r741298 = atan2(r741289, r741288);
        double r741299 = y_im;
        double r741300 = r741298 * r741299;
        double r741301 = r741297 - r741300;
        double r741302 = exp(r741301);
        double r741303 = log(r741290);
        double r741304 = cbrt(r741298);
        double r741305 = r741304 * r741304;
        double r741306 = r741305 * r741287;
        double r741307 = r741304 * r741306;
        double r741308 = fma(r741303, r741299, r741307);
        double r741309 = cos(r741308);
        double r741310 = expm1(r741309);
        double r741311 = log1p(r741310);
        double r741312 = r741302 * r741311;
        return r741312;
}

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.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. Simplified3.4

    \[\leadsto \color{blue}{e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt3.4

    \[\leadsto e^{y.re \cdot \log \color{blue}{\left(\left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\]
  5. Applied log-prod3.4

    \[\leadsto e^{y.re \cdot \color{blue}{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right)\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\]
  6. Applied distribute-rgt-in3.4

    \[\leadsto e^{\color{blue}{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\]
  7. Using strategy rm
  8. Applied add-cube-cbrt3.4

    \[\leadsto e^{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \tan^{-1}_* \frac{x.im}{x.re} \cdot \color{blue}{\left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \sqrt[3]{y.re}\right)}\right)\right)\]
  9. Applied associate-*r*3.4

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

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

    \[\leadsto e^{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)}\right)\]
  13. Using strategy rm
  14. Applied add-cube-cbrt3.4

    \[\leadsto e^{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \color{blue}{\left(\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right)}\right)\right)\right)\right)\]
  15. Applied associate-*r*3.4

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

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

Reproduce

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