Average Error: 32.7 → 3.8
Time: 50.1s
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 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.re}} \cdot \sqrt[3]{\sqrt[3]{y.re}}\right) \cdot \sqrt[3]{\sqrt[3]{y.re}}\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 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.re}} \cdot \sqrt[3]{\sqrt[3]{y.re}}\right) \cdot \sqrt[3]{\sqrt[3]{y.re}}\right)\right)\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1912602 = x_re;
        double r1912603 = r1912602 * r1912602;
        double r1912604 = x_im;
        double r1912605 = r1912604 * r1912604;
        double r1912606 = r1912603 + r1912605;
        double r1912607 = sqrt(r1912606);
        double r1912608 = log(r1912607);
        double r1912609 = y_re;
        double r1912610 = r1912608 * r1912609;
        double r1912611 = atan2(r1912604, r1912602);
        double r1912612 = y_im;
        double r1912613 = r1912611 * r1912612;
        double r1912614 = r1912610 - r1912613;
        double r1912615 = exp(r1912614);
        double r1912616 = r1912608 * r1912612;
        double r1912617 = r1912611 * r1912609;
        double r1912618 = r1912616 + r1912617;
        double r1912619 = sin(r1912618);
        double r1912620 = r1912615 * r1912619;
        return r1912620;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1912621 = x_re;
        double r1912622 = x_im;
        double r1912623 = hypot(r1912621, r1912622);
        double r1912624 = log(r1912623);
        double r1912625 = y_re;
        double r1912626 = r1912624 * r1912625;
        double r1912627 = y_im;
        double r1912628 = atan2(r1912622, r1912621);
        double r1912629 = r1912627 * r1912628;
        double r1912630 = r1912626 - r1912629;
        double r1912631 = exp(r1912630);
        double r1912632 = cbrt(r1912625);
        double r1912633 = r1912632 * r1912632;
        double r1912634 = r1912633 * r1912628;
        double r1912635 = cbrt(r1912632);
        double r1912636 = r1912635 * r1912635;
        double r1912637 = r1912636 * r1912635;
        double r1912638 = r1912634 * r1912637;
        double r1912639 = fma(r1912627, r1912624, r1912638);
        double r1912640 = sin(r1912639);
        double r1912641 = r1912631 * r1912640;
        return r1912641;
}

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.5

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

    \[\leadsto 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 \color{blue}{\left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \sqrt[3]{y.re}\right)}\right)\right)\]
  5. Applied associate-*r*3.7

    \[\leadsto 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), \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)\]
  6. Using strategy rm
  7. Applied add-cube-cbrt3.8

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

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

Reproduce

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