Average Error: 33.8 → 3.9
Time: 27.5s
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), 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 - 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), 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 r1034740 = x_re;
        double r1034741 = r1034740 * r1034740;
        double r1034742 = x_im;
        double r1034743 = r1034742 * r1034742;
        double r1034744 = r1034741 + r1034743;
        double r1034745 = sqrt(r1034744);
        double r1034746 = log(r1034745);
        double r1034747 = y_re;
        double r1034748 = r1034746 * r1034747;
        double r1034749 = atan2(r1034742, r1034740);
        double r1034750 = y_im;
        double r1034751 = r1034749 * r1034750;
        double r1034752 = r1034748 - r1034751;
        double r1034753 = exp(r1034752);
        double r1034754 = r1034746 * r1034750;
        double r1034755 = r1034749 * r1034747;
        double r1034756 = r1034754 + r1034755;
        double r1034757 = sin(r1034756);
        double r1034758 = r1034753 * r1034757;
        return r1034758;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1034759 = x_re;
        double r1034760 = x_im;
        double r1034761 = hypot(r1034759, r1034760);
        double r1034762 = log(r1034761);
        double r1034763 = y_re;
        double r1034764 = r1034762 * r1034763;
        double r1034765 = y_im;
        double r1034766 = atan2(r1034760, r1034759);
        double r1034767 = r1034765 * r1034766;
        double r1034768 = r1034764 - r1034767;
        double r1034769 = exp(r1034768);
        double r1034770 = r1034763 * r1034766;
        double r1034771 = fma(r1034765, r1034762, r1034770);
        double r1034772 = sin(r1034771);
        double r1034773 = log1p(r1034772);
        double r1034774 = expm1(r1034773);
        double r1034775 = r1034769 * r1034774;
        return r1034775;
}

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

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

    \[\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 expm1-log1p-u3.9

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

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

Reproduce

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