Average Error: 33.1 → 3.6
Time: 33.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 \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^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)} \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)\]
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^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \left(\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)} \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)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1189573 = x_re;
        double r1189574 = r1189573 * r1189573;
        double r1189575 = x_im;
        double r1189576 = r1189575 * r1189575;
        double r1189577 = r1189574 + r1189576;
        double r1189578 = sqrt(r1189577);
        double r1189579 = log(r1189578);
        double r1189580 = y_re;
        double r1189581 = r1189579 * r1189580;
        double r1189582 = atan2(r1189575, r1189573);
        double r1189583 = y_im;
        double r1189584 = r1189582 * r1189583;
        double r1189585 = r1189581 - r1189584;
        double r1189586 = exp(r1189585);
        double r1189587 = r1189579 * r1189583;
        double r1189588 = r1189582 * r1189580;
        double r1189589 = r1189587 + r1189588;
        double r1189590 = sin(r1189589);
        double r1189591 = r1189586 * r1189590;
        return r1189591;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1189592 = y_re;
        double r1189593 = x_re;
        double r1189594 = x_im;
        double r1189595 = hypot(r1189593, r1189594);
        double r1189596 = log(r1189595);
        double r1189597 = r1189592 * r1189596;
        double r1189598 = y_im;
        double r1189599 = cbrt(r1189598);
        double r1189600 = r1189599 * r1189599;
        double r1189601 = atan2(r1189594, r1189593);
        double r1189602 = r1189600 * r1189601;
        double r1189603 = cbrt(r1189599);
        double r1189604 = r1189603 * r1189603;
        double r1189605 = r1189604 * r1189603;
        double r1189606 = r1189602 * r1189605;
        double r1189607 = r1189597 - r1189606;
        double r1189608 = exp(r1189607);
        double r1189609 = r1189601 * r1189592;
        double r1189610 = fma(r1189598, r1189596, r1189609);
        double r1189611 = sin(r1189610);
        double r1189612 = r1189608 * r1189611;
        return r1189612;
}

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 33.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 \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.6

    \[\leadsto \color{blue}{\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) \cdot 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}}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt3.6

    \[\leadsto \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) \cdot e^{y.re \cdot \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.im} \cdot \sqrt[3]{y.im}\right) \cdot \sqrt[3]{y.im}\right)}}\]
  5. Applied associate-*r*3.6

    \[\leadsto \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) \cdot e^{y.re \cdot \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.im} \cdot \sqrt[3]{y.im}\right)\right) \cdot \sqrt[3]{y.im}}}\]
  6. Using strategy rm
  7. Applied add-cube-cbrt3.6

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

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

Reproduce

herbie shell --seed 2019163 +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)))))