Average Error: 33.7 → 6.6
Time: 34.0s
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)\]
\[\begin{array}{l} \mathbf{if}\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \le 1.872237306821422011231180291389045259297 \cdot 10^{-46}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)} \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)}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}\\ \end{array}\]
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)
\begin{array}{l}
\mathbf{if}\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \le 1.872237306821422011231180291389045259297 \cdot 10^{-46}:\\
\;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)} \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)}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r32941 = x_re;
        double r32942 = r32941 * r32941;
        double r32943 = x_im;
        double r32944 = r32943 * r32943;
        double r32945 = r32942 + r32944;
        double r32946 = sqrt(r32945);
        double r32947 = log(r32946);
        double r32948 = y_re;
        double r32949 = r32947 * r32948;
        double r32950 = atan2(r32943, r32941);
        double r32951 = y_im;
        double r32952 = r32950 * r32951;
        double r32953 = r32949 - r32952;
        double r32954 = exp(r32953);
        double r32955 = r32947 * r32951;
        double r32956 = r32950 * r32948;
        double r32957 = r32955 + r32956;
        double r32958 = sin(r32957);
        double r32959 = r32954 * r32958;
        return r32959;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r32960 = y_im;
        double r32961 = x_re;
        double r32962 = r32961 * r32961;
        double r32963 = x_im;
        double r32964 = r32963 * r32963;
        double r32965 = r32962 + r32964;
        double r32966 = sqrt(r32965);
        double r32967 = log(r32966);
        double r32968 = r32960 * r32967;
        double r32969 = atan2(r32963, r32961);
        double r32970 = y_re;
        double r32971 = r32969 * r32970;
        double r32972 = r32968 + r32971;
        double r32973 = sin(r32972);
        double r32974 = r32970 * r32967;
        double r32975 = r32969 * r32960;
        double r32976 = r32974 - r32975;
        double r32977 = exp(r32976);
        double r32978 = r32973 * r32977;
        double r32979 = 1.872237306821422e-46;
        bool r32980 = r32978 <= r32979;
        double r32981 = hypot(r32961, r32963);
        double r32982 = 2.0;
        double r32983 = r32970 / r32982;
        double r32984 = pow(r32981, r32983);
        double r32985 = log(r32981);
        double r32986 = fma(r32960, r32985, r32971);
        double r32987 = sin(r32986);
        double r32988 = r32984 * r32987;
        double r32989 = exp(r32960);
        double r32990 = pow(r32989, r32969);
        double r32991 = r32988 / r32990;
        double r32992 = r32991 * r32984;
        double r32993 = r32980 ? r32978 : r32992;
        return r32993;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Split input into 2 regimes
  2. if (* (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)))) < 1.872237306821422e-46

    1. Initial program 1.7

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

    if 1.872237306821422e-46 < (* (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))))

    1. Initial program 61.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. Simplified10.9

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{\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 *-un-lft-identity10.9

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{\color{blue}{1 \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)}}}\]
    5. Applied *-un-lft-identity10.9

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\frac{{\color{blue}{\left(1 \cdot e^{y.im}\right)}}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{1 \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)}}\]
    6. Applied unpow-prod-down10.9

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\frac{\color{blue}{{1}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot {\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}}{1 \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)}}\]
    7. Applied times-frac10.9

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{\frac{{1}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{1} \cdot \frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{\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)}}}\]
    8. Applied sqr-pow10.9

      \[\leadsto \frac{\color{blue}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)} \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}}}{\frac{{1}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{1} \cdot \frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{\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)}}\]
    9. Applied times-frac10.9

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}}{\frac{{1}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{1}} \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}}{\frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{\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)}}}\]
    10. Simplified10.9

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}} \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}}{\frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{\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)}}\]
    11. Simplified10.8

      \[\leadsto {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)} \cdot \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)} \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)}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \le 1.872237306821422011231180291389045259297 \cdot 10^{-46}:\\ \;\;\;\;\sin \left(y.im \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)} \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)}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(\frac{y.re}{2}\right)}\\ \end{array}\]

Reproduce

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