Average Error: 32.6 → 3.4
Time: 34.3s
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{\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot \sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) + \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re}}\]
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{\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot \sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) + \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r997941 = x_re;
        double r997942 = r997941 * r997941;
        double r997943 = x_im;
        double r997944 = r997943 * r997943;
        double r997945 = r997942 + r997944;
        double r997946 = sqrt(r997945);
        double r997947 = log(r997946);
        double r997948 = y_re;
        double r997949 = r997947 * r997948;
        double r997950 = atan2(r997943, r997941);
        double r997951 = y_im;
        double r997952 = r997950 * r997951;
        double r997953 = r997949 - r997952;
        double r997954 = exp(r997953);
        double r997955 = r997947 * r997951;
        double r997956 = r997950 * r997948;
        double r997957 = r997955 + r997956;
        double r997958 = sin(r997957);
        double r997959 = r997954 * r997958;
        return r997959;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r997960 = x_im;
        double r997961 = x_re;
        double r997962 = atan2(r997960, r997961);
        double r997963 = y_re;
        double r997964 = r997962 * r997963;
        double r997965 = cos(r997964);
        double r997966 = hypot(r997961, r997960);
        double r997967 = log(r997966);
        double r997968 = y_im;
        double r997969 = r997967 * r997968;
        double r997970 = sin(r997969);
        double r997971 = r997965 * r997970;
        double r997972 = sin(r997964);
        double r997973 = cos(r997969);
        double r997974 = r997972 * r997973;
        double r997975 = r997971 + r997974;
        double r997976 = expm1(r997975);
        double r997977 = log1p(r997976);
        double r997978 = r997962 * r997968;
        double r997979 = r997967 * r997963;
        double r997980 = r997978 - r997979;
        double r997981 = exp(r997980);
        double r997982 = r997977 / r997981;
        return r997982;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 32.6

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

    \[\leadsto \color{blue}{\frac{\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)}{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. Using strategy rm
  4. Applied log1p-expm1-u3.4

    \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\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^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\]
  5. Using strategy rm
  6. Applied fma-udef3.4

    \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \color{blue}{\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) + \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)}}\]
  7. Applied sin-sum3.4

    \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right) \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right) \cdot \sin \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)}}\]
  8. Final simplification3.4

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

Reproduce

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