Average Error: 32.7 → 3.4
Time: 25.8s
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 \sin \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^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\right)\right)\right)} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\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 \sin \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^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\right)\right)\right)} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1185329 = x_re;
        double r1185330 = r1185329 * r1185329;
        double r1185331 = x_im;
        double r1185332 = r1185331 * r1185331;
        double r1185333 = r1185330 + r1185332;
        double r1185334 = sqrt(r1185333);
        double r1185335 = log(r1185334);
        double r1185336 = y_re;
        double r1185337 = r1185335 * r1185336;
        double r1185338 = atan2(r1185331, r1185329);
        double r1185339 = y_im;
        double r1185340 = r1185338 * r1185339;
        double r1185341 = r1185337 - r1185340;
        double r1185342 = exp(r1185341);
        double r1185343 = r1185335 * r1185339;
        double r1185344 = r1185338 * r1185336;
        double r1185345 = r1185343 + r1185344;
        double r1185346 = sin(r1185345);
        double r1185347 = r1185342 * r1185346;
        return r1185347;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1185348 = x_re;
        double r1185349 = x_im;
        double r1185350 = hypot(r1185348, r1185349);
        double r1185351 = log(r1185350);
        double r1185352 = y_re;
        double r1185353 = r1185351 * r1185352;
        double r1185354 = y_im;
        double r1185355 = atan2(r1185349, r1185348);
        double r1185356 = r1185354 * r1185355;
        double r1185357 = cbrt(r1185356);
        double r1185358 = cbrt(r1185357);
        double r1185359 = r1185358 * r1185358;
        double r1185360 = r1185358 * r1185359;
        double r1185361 = r1185357 * r1185360;
        double r1185362 = r1185357 * r1185361;
        double r1185363 = r1185353 - r1185362;
        double r1185364 = exp(r1185363);
        double r1185365 = r1185352 * r1185355;
        double r1185366 = fma(r1185354, r1185351, r1185365);
        double r1185367 = sin(r1185366);
        double r1185368 = log1p(r1185367);
        double r1185369 = expm1(r1185368);
        double r1185370 = r1185364 * r1185369;
        return r1185370;
}

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.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 \sin \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 \sin \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 \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \color{blue}{\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot \sin \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. Using strategy rm
  6. Applied add-cube-cbrt3.4

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sin \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 expm1-log1p-u3.4

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \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)\right)\right)}\]
  9. Final simplification3.4

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

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))