Average Error: 33.9 → 3.5
Time: 47.7s
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 \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)\]
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 \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)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1379720 = x_re;
        double r1379721 = r1379720 * r1379720;
        double r1379722 = x_im;
        double r1379723 = r1379722 * r1379722;
        double r1379724 = r1379721 + r1379723;
        double r1379725 = sqrt(r1379724);
        double r1379726 = log(r1379725);
        double r1379727 = y_re;
        double r1379728 = r1379726 * r1379727;
        double r1379729 = atan2(r1379722, r1379720);
        double r1379730 = y_im;
        double r1379731 = r1379729 * r1379730;
        double r1379732 = r1379728 - r1379731;
        double r1379733 = exp(r1379732);
        double r1379734 = r1379726 * r1379730;
        double r1379735 = r1379729 * r1379727;
        double r1379736 = r1379734 + r1379735;
        double r1379737 = sin(r1379736);
        double r1379738 = r1379733 * r1379737;
        return r1379738;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1379739 = x_re;
        double r1379740 = x_im;
        double r1379741 = hypot(r1379739, r1379740);
        double r1379742 = log(r1379741);
        double r1379743 = y_re;
        double r1379744 = r1379742 * r1379743;
        double r1379745 = y_im;
        double r1379746 = atan2(r1379740, r1379739);
        double r1379747 = r1379745 * r1379746;
        double r1379748 = r1379744 - r1379747;
        double r1379749 = exp(r1379748);
        double r1379750 = r1379746 * r1379743;
        double r1379751 = fma(r1379745, r1379742, r1379750);
        double r1379752 = sin(r1379751);
        double r1379753 = log1p(r1379752);
        double r1379754 = expm1(r1379753);
        double r1379755 = r1379749 * r1379754;
        return r1379755;
}

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

    \[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), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\]
  3. Using strategy rm
  4. Applied expm1-log1p-u3.5

    \[\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 \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), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)}\]
  5. Final simplification3.5

    \[\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 \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)\]

Reproduce

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