Average Error: 33.8 → 8.4
Time: 17.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}\;x.re \le -3.853834220586221 \cdot 10^{184}:\\ \;\;\;\;\frac{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - \left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)}}\\ \mathbf{elif}\;x.re \le 2.2092076921331203 \cdot 10^{89}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \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^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, y.im \cdot \log x.re\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log x.re}}\\ \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}\;x.re \le -3.853834220586221 \cdot 10^{184}:\\
\;\;\;\;\frac{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - \left(-y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, y.im \cdot \log x.re\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log x.re}}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r21961 = x_re;
        double r21962 = r21961 * r21961;
        double r21963 = x_im;
        double r21964 = r21963 * r21963;
        double r21965 = r21962 + r21964;
        double r21966 = sqrt(r21965);
        double r21967 = log(r21966);
        double r21968 = y_re;
        double r21969 = r21967 * r21968;
        double r21970 = atan2(r21963, r21961);
        double r21971 = y_im;
        double r21972 = r21970 * r21971;
        double r21973 = r21969 - r21972;
        double r21974 = exp(r21973);
        double r21975 = r21967 * r21971;
        double r21976 = r21970 * r21968;
        double r21977 = r21975 + r21976;
        double r21978 = sin(r21977);
        double r21979 = r21974 * r21978;
        return r21979;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r21980 = x_re;
        double r21981 = -3.853834220586221e+184;
        bool r21982 = r21980 <= r21981;
        double r21983 = x_im;
        double r21984 = atan2(r21983, r21980);
        double r21985 = y_re;
        double r21986 = r21984 * r21985;
        double r21987 = y_im;
        double r21988 = -1.0;
        double r21989 = r21988 / r21980;
        double r21990 = log(r21989);
        double r21991 = r21987 * r21990;
        double r21992 = r21986 - r21991;
        double r21993 = sin(r21992);
        double r21994 = r21984 * r21987;
        double r21995 = r21985 * r21990;
        double r21996 = -r21995;
        double r21997 = r21994 - r21996;
        double r21998 = exp(r21997);
        double r21999 = r21993 / r21998;
        double r22000 = 2.2092076921331203e+89;
        bool r22001 = r21980 <= r22000;
        double r22002 = hypot(r21980, r21983);
        double r22003 = pow(r22002, r21985);
        double r22004 = log(r22002);
        double r22005 = r22004 * r21987;
        double r22006 = sin(r22005);
        double r22007 = cos(r21986);
        double r22008 = r22006 * r22007;
        double r22009 = cos(r22005);
        double r22010 = sin(r21986);
        double r22011 = r22009 * r22010;
        double r22012 = r22008 + r22011;
        double r22013 = r22003 * r22012;
        double r22014 = exp(r21994);
        double r22015 = r22013 / r22014;
        double r22016 = log(r21980);
        double r22017 = r21987 * r22016;
        double r22018 = fma(r21984, r21985, r22017);
        double r22019 = sin(r22018);
        double r22020 = r21985 * r22016;
        double r22021 = r21994 - r22020;
        double r22022 = exp(r22021);
        double r22023 = r22019 / r22022;
        double r22024 = r22001 ? r22015 : r22023;
        double r22025 = r21982 ? r21999 : r22024;
        return r22025;
}

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 3 regimes
  2. if x.re < -3.853834220586221e+184

    1. Initial program 64.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. Simplified7.2

      \[\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. Taylor expanded around -inf 8.4

      \[\leadsto \color{blue}{\frac{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right) \cdot e^{-1 \cdot \left(y.re \cdot \log \left(\frac{-1}{x.re}\right)\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\]
    4. Simplified1.5

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

    if -3.853834220586221e+184 < x.re < 2.2092076921331203e+89

    1. Initial program 24.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.1

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

      \[\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^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\]
    5. Applied sin-sum8.1

      \[\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^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\]

    if 2.2092076921331203e+89 < x.re

    1. Initial program 52.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. Simplified13.7

      \[\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. Taylor expanded around inf 15.6

      \[\leadsto \color{blue}{\frac{\sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{1}{x.re}\right)\right) \cdot e^{-1 \cdot \left(y.re \cdot \log \left(\frac{1}{x.re}\right)\right)}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\]
    4. Simplified13.1

      \[\leadsto \color{blue}{\frac{\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, y.im \cdot \log x.re\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log x.re}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification8.4

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

Reproduce

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