Average Error: 33.0 → 6.2
Time: 24.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 \cos \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}\;\cos \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 0.9999999883399439681852527428418397903442:\\ \;\;\;\;\cos \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)}^{y.re}}{{e}^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\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 \cos \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}\;\cos \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 0.9999999883399439681852527428418397903442:\\
\;\;\;\;\cos \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)}^{y.re}}{{e}^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r24752 = x_re;
        double r24753 = r24752 * r24752;
        double r24754 = x_im;
        double r24755 = r24754 * r24754;
        double r24756 = r24753 + r24755;
        double r24757 = sqrt(r24756);
        double r24758 = log(r24757);
        double r24759 = y_re;
        double r24760 = r24758 * r24759;
        double r24761 = atan2(r24754, r24752);
        double r24762 = y_im;
        double r24763 = r24761 * r24762;
        double r24764 = r24760 - r24763;
        double r24765 = exp(r24764);
        double r24766 = r24758 * r24762;
        double r24767 = r24761 * r24759;
        double r24768 = r24766 + r24767;
        double r24769 = cos(r24768);
        double r24770 = r24765 * r24769;
        return r24770;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r24771 = y_im;
        double r24772 = x_re;
        double r24773 = r24772 * r24772;
        double r24774 = x_im;
        double r24775 = r24774 * r24774;
        double r24776 = r24773 + r24775;
        double r24777 = sqrt(r24776);
        double r24778 = log(r24777);
        double r24779 = r24771 * r24778;
        double r24780 = atan2(r24774, r24772);
        double r24781 = y_re;
        double r24782 = r24780 * r24781;
        double r24783 = r24779 + r24782;
        double r24784 = cos(r24783);
        double r24785 = r24781 * r24778;
        double r24786 = r24780 * r24771;
        double r24787 = r24785 - r24786;
        double r24788 = exp(r24787);
        double r24789 = r24784 * r24788;
        double r24790 = 0.999999988339944;
        bool r24791 = r24789 <= r24790;
        double r24792 = hypot(r24772, r24774);
        double r24793 = pow(r24792, r24781);
        double r24794 = exp(1.0);
        double r24795 = pow(r24794, r24786);
        double r24796 = r24793 / r24795;
        double r24797 = r24791 ? r24789 : r24796;
        return r24797;
}

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))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))) < 0.999999988339944

    1. Initial program 4.1

      \[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 \cos \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.999999988339944 < (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re))))

    1. Initial program 46.2

      \[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 \cos \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}}{\frac{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}{\cos \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-identity7.2

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

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

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

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\frac{{\left(e^{1}\right)}^{\color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}}}{\cos \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. Using strategy rm
    9. Applied add-cbrt-cube6.8

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

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\frac{{\left(e^{1}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}}{\sqrt[3]{\color{blue}{{\left(\cos \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)\right)}^{3}}}}}\]
    11. Taylor expanded around 0 7.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \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 0.9999999883399439681852527428418397903442:\\ \;\;\;\;\cos \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)}^{y.re}}{{e}^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))