Average Error: 31.0 → 0.1
Time: 3.8m
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)\]
\[\frac{\sin \left(\mathsf{fma}\left(y.im, \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right), \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\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)
\frac{\sin \left(\mathsf{fma}\left(y.im, \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right), \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1001852 = x_re;
        double r1001853 = r1001852 * r1001852;
        double r1001854 = x_im;
        double r1001855 = r1001854 * r1001854;
        double r1001856 = r1001853 + r1001855;
        double r1001857 = sqrt(r1001856);
        double r1001858 = log(r1001857);
        double r1001859 = y_re;
        double r1001860 = r1001858 * r1001859;
        double r1001861 = atan2(r1001854, r1001852);
        double r1001862 = y_im;
        double r1001863 = r1001861 * r1001862;
        double r1001864 = r1001860 - r1001863;
        double r1001865 = exp(r1001864);
        double r1001866 = r1001858 * r1001862;
        double r1001867 = r1001861 * r1001859;
        double r1001868 = r1001866 + r1001867;
        double r1001869 = sin(r1001868);
        double r1001870 = r1001865 * r1001869;
        return r1001870;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1001871 = y_im;
        double r1001872 = x_re;
        double r1001873 = x_im;
        double r1001874 = hypot(r1001872, r1001873);
        double r1001875 = log(r1001874);
        double r1001876 = atan2(r1001873, r1001872);
        double r1001877 = y_re;
        double r1001878 = r1001876 * r1001877;
        double r1001879 = fma(r1001871, r1001875, r1001878);
        double r1001880 = sin(r1001879);
        double r1001881 = r1001876 * r1001871;
        double r1001882 = r1001877 * r1001875;
        double r1001883 = r1001881 - r1001882;
        double r1001884 = exp(r1001883);
        double r1001885 = r1001880 / r1001884;
        return r1001885;
}

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 31.0

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

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

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

Reproduce

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