Average Error: 30.9 → 0.2
Time: 3.7m
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 r642891 = x_re;
        double r642892 = r642891 * r642891;
        double r642893 = x_im;
        double r642894 = r642893 * r642893;
        double r642895 = r642892 + r642894;
        double r642896 = sqrt(r642895);
        double r642897 = log(r642896);
        double r642898 = y_re;
        double r642899 = r642897 * r642898;
        double r642900 = atan2(r642893, r642891);
        double r642901 = y_im;
        double r642902 = r642900 * r642901;
        double r642903 = r642899 - r642902;
        double r642904 = exp(r642903);
        double r642905 = r642897 * r642901;
        double r642906 = r642900 * r642898;
        double r642907 = r642905 + r642906;
        double r642908 = sin(r642907);
        double r642909 = r642904 * r642908;
        return r642909;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r642910 = y_im;
        double r642911 = x_re;
        double r642912 = x_im;
        double r642913 = hypot(r642911, r642912);
        double r642914 = log(r642913);
        double r642915 = atan2(r642912, r642911);
        double r642916 = y_re;
        double r642917 = r642915 * r642916;
        double r642918 = fma(r642910, r642914, r642917);
        double r642919 = sin(r642918);
        double r642920 = r642915 * r642910;
        double r642921 = r642916 * r642914;
        double r642922 = r642920 - r642921;
        double r642923 = exp(r642922);
        double r642924 = r642919 / r642923;
        return r642924;
}

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 30.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. Simplified0.2

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

    \[\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 2019128 +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)))))