Average Error: 33.3 → 5.8
Time: 21.6s
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}\;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) \le -0.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)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right) \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\\ \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}\;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) \le -0.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)\\

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

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r22877 = x_re;
        double r22878 = r22877 * r22877;
        double r22879 = x_im;
        double r22880 = r22879 * r22879;
        double r22881 = r22878 + r22880;
        double r22882 = sqrt(r22881);
        double r22883 = log(r22882);
        double r22884 = y_re;
        double r22885 = r22883 * r22884;
        double r22886 = atan2(r22879, r22877);
        double r22887 = y_im;
        double r22888 = r22886 * r22887;
        double r22889 = r22885 - r22888;
        double r22890 = exp(r22889);
        double r22891 = r22883 * r22887;
        double r22892 = r22886 * r22884;
        double r22893 = r22891 + r22892;
        double r22894 = sin(r22893);
        double r22895 = r22890 * r22894;
        return r22895;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r22896 = x_re;
        double r22897 = r22896 * r22896;
        double r22898 = x_im;
        double r22899 = r22898 * r22898;
        double r22900 = r22897 + r22899;
        double r22901 = sqrt(r22900);
        double r22902 = log(r22901);
        double r22903 = y_re;
        double r22904 = r22902 * r22903;
        double r22905 = atan2(r22898, r22896);
        double r22906 = y_im;
        double r22907 = r22905 * r22906;
        double r22908 = r22904 - r22907;
        double r22909 = exp(r22908);
        double r22910 = r22902 * r22906;
        double r22911 = r22905 * r22903;
        double r22912 = r22910 + r22911;
        double r22913 = sin(r22912);
        double r22914 = r22909 * r22913;
        double r22915 = -0.0;
        bool r22916 = r22914 <= r22915;
        double r22917 = hypot(r22896, r22898);
        double r22918 = pow(r22917, r22903);
        double r22919 = log(r22917);
        double r22920 = r22919 * r22906;
        double r22921 = sin(r22920);
        double r22922 = log1p(r22921);
        double r22923 = expm1(r22922);
        double r22924 = cos(r22911);
        double r22925 = r22923 * r22924;
        double r22926 = cos(r22920);
        double r22927 = sin(r22911);
        double r22928 = r22926 * r22927;
        double r22929 = r22925 + r22928;
        double r22930 = r22918 * r22929;
        double r22931 = cbrt(r22906);
        double r22932 = cbrt(r22931);
        double r22933 = r22932 * r22932;
        double r22934 = r22933 * r22932;
        double r22935 = r22931 * r22934;
        double r22936 = r22905 * r22935;
        double r22937 = r22936 * r22931;
        double r22938 = exp(r22937);
        double r22939 = r22930 / r22938;
        double r22940 = r22916 ? r22914 : r22939;
        return r22940;
}

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. 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)))) < -0.0

    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 -0.0 < (* (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 53.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. Simplified8.4

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt8.4

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

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)\right) \cdot \sqrt[3]{y.im}}}}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)}\right)\right) \cdot \sqrt[3]{y.im}}}\]
    8. Using strategy rm
    9. Applied fma-udef8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\]
    10. Applied sin-sum8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \color{blue}{\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\]
    11. Using strategy rm
    12. Applied expm1-log1p-u8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right)} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.8

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

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  :precision binary64
  (* (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)))))