Average Error: 33.3 → 5.8
Time: 16.8s
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 r23789 = x_re;
        double r23790 = r23789 * r23789;
        double r23791 = x_im;
        double r23792 = r23791 * r23791;
        double r23793 = r23790 + r23792;
        double r23794 = sqrt(r23793);
        double r23795 = log(r23794);
        double r23796 = y_re;
        double r23797 = r23795 * r23796;
        double r23798 = atan2(r23791, r23789);
        double r23799 = y_im;
        double r23800 = r23798 * r23799;
        double r23801 = r23797 - r23800;
        double r23802 = exp(r23801);
        double r23803 = r23795 * r23799;
        double r23804 = r23798 * r23796;
        double r23805 = r23803 + r23804;
        double r23806 = sin(r23805);
        double r23807 = r23802 * r23806;
        return r23807;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r23808 = x_re;
        double r23809 = r23808 * r23808;
        double r23810 = x_im;
        double r23811 = r23810 * r23810;
        double r23812 = r23809 + r23811;
        double r23813 = sqrt(r23812);
        double r23814 = log(r23813);
        double r23815 = y_re;
        double r23816 = r23814 * r23815;
        double r23817 = atan2(r23810, r23808);
        double r23818 = y_im;
        double r23819 = r23817 * r23818;
        double r23820 = r23816 - r23819;
        double r23821 = exp(r23820);
        double r23822 = r23814 * r23818;
        double r23823 = r23817 * r23815;
        double r23824 = r23822 + r23823;
        double r23825 = sin(r23824);
        double r23826 = r23821 * r23825;
        double r23827 = -0.0;
        bool r23828 = r23826 <= r23827;
        double r23829 = hypot(r23808, r23810);
        double r23830 = pow(r23829, r23815);
        double r23831 = log(r23829);
        double r23832 = r23831 * r23818;
        double r23833 = sin(r23832);
        double r23834 = log1p(r23833);
        double r23835 = expm1(r23834);
        double r23836 = cos(r23823);
        double r23837 = r23835 * r23836;
        double r23838 = cos(r23832);
        double r23839 = sin(r23823);
        double r23840 = r23838 * r23839;
        double r23841 = r23837 + r23840;
        double r23842 = r23830 * r23841;
        double r23843 = cbrt(r23818);
        double r23844 = cbrt(r23843);
        double r23845 = r23844 * r23844;
        double r23846 = r23845 * r23844;
        double r23847 = r23843 * r23846;
        double r23848 = r23817 * r23847;
        double r23849 = r23848 * r23843;
        double r23850 = exp(r23849);
        double r23851 = r23842 / r23850;
        double r23852 = r23828 ? r23826 : r23851;
        return r23852;
}

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