Average Error: 33.5 → 3.5
Time: 24.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)\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \left(\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) \cdot \sqrt[3]{\sqrt[3]{y.im} \cdot \tan^{-1}_* \frac{x.im}{x.re}}\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)
\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \left(\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) \cdot \sqrt[3]{\sqrt[3]{y.im} \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r25616 = x_re;
        double r25617 = r25616 * r25616;
        double r25618 = x_im;
        double r25619 = r25618 * r25618;
        double r25620 = r25617 + r25619;
        double r25621 = sqrt(r25620);
        double r25622 = log(r25621);
        double r25623 = y_re;
        double r25624 = r25622 * r25623;
        double r25625 = atan2(r25618, r25616);
        double r25626 = y_im;
        double r25627 = r25625 * r25626;
        double r25628 = r25624 - r25627;
        double r25629 = exp(r25628);
        double r25630 = r25622 * r25626;
        double r25631 = r25625 * r25623;
        double r25632 = r25630 + r25631;
        double r25633 = sin(r25632);
        double r25634 = r25629 * r25633;
        return r25634;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r25635 = x_re;
        double r25636 = x_im;
        double r25637 = hypot(r25635, r25636);
        double r25638 = log(r25637);
        double r25639 = y_im;
        double r25640 = atan2(r25636, r25635);
        double r25641 = y_re;
        double r25642 = r25640 * r25641;
        double r25643 = fma(r25638, r25639, r25642);
        double r25644 = sin(r25643);
        double r25645 = expm1(r25644);
        double r25646 = log1p(r25645);
        double r25647 = r25638 * r25641;
        double r25648 = cbrt(r25639);
        double r25649 = r25648 * r25648;
        double r25650 = r25648 * r25640;
        double r25651 = cbrt(r25650);
        double r25652 = r25651 * r25651;
        double r25653 = r25652 * r25651;
        double r25654 = r25649 * r25653;
        double r25655 = r25647 - r25654;
        double r25656 = exp(r25655);
        double r25657 = r25646 * r25656;
        return r25657;
}

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.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 \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. Simplified8.9

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

    \[\leadsto \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot \frac{{\color{blue}{\left(e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}\right)}}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\]
  5. Applied pow-exp8.9

    \[\leadsto \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right) \cdot \frac{\color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re}}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\]
  6. Applied div-exp3.5

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

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

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

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

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

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

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

Reproduce

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