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

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{{\left(\left(\sqrt[3]{\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)} \cdot \sqrt[3]{\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)}\right) \cdot \sqrt[3]{\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)}\right)}^{3}} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) - \sin \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) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r25138 = x_re;
        double r25139 = r25138 * r25138;
        double r25140 = x_im;
        double r25141 = r25140 * r25140;
        double r25142 = r25139 + r25141;
        double r25143 = sqrt(r25142);
        double r25144 = log(r25143);
        double r25145 = y_re;
        double r25146 = r25144 * r25145;
        double r25147 = atan2(r25140, r25138);
        double r25148 = y_im;
        double r25149 = r25147 * r25148;
        double r25150 = r25146 - r25149;
        double r25151 = exp(r25150);
        double r25152 = r25144 * r25148;
        double r25153 = r25147 * r25145;
        double r25154 = r25152 + r25153;
        double r25155 = cos(r25154);
        double r25156 = r25151 * r25155;
        return r25156;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r25157 = x_re;
        double r25158 = r25157 * r25157;
        double r25159 = x_im;
        double r25160 = r25159 * r25159;
        double r25161 = r25158 + r25160;
        double r25162 = sqrt(r25161);
        double r25163 = log(r25162);
        double r25164 = y_re;
        double r25165 = r25163 * r25164;
        double r25166 = atan2(r25159, r25157);
        double r25167 = y_im;
        double r25168 = r25166 * r25167;
        double r25169 = r25165 - r25168;
        double r25170 = exp(r25169);
        double r25171 = r25163 * r25167;
        double r25172 = r25166 * r25164;
        double r25173 = r25171 + r25172;
        double r25174 = cos(r25173);
        double r25175 = r25170 * r25174;
        double r25176 = 0.0;
        bool r25177 = r25175 <= r25176;
        double r25178 = hypot(r25157, r25159);
        double r25179 = log(r25178);
        double r25180 = r25179 * r25167;
        double r25181 = cos(r25180);
        double r25182 = cbrt(r25181);
        double r25183 = r25182 * r25182;
        double r25184 = r25183 * r25182;
        double r25185 = 3.0;
        double r25186 = pow(r25184, r25185);
        double r25187 = cbrt(r25186);
        double r25188 = cos(r25172);
        double r25189 = r25187 * r25188;
        double r25190 = sin(r25180);
        double r25191 = sin(r25172);
        double r25192 = r25190 * r25191;
        double r25193 = r25189 - r25192;
        double r25194 = pow(r25178, r25164);
        double r25195 = exp(r25168);
        double r25196 = r25194 / r25195;
        double r25197 = r25193 * r25196;
        double r25198 = r25177 ? r25175 : r25197;
        return r25198;
}

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.0

    1. Initial program 4.9

      \[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.0 < (* (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 39.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 \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.8

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

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

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

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

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

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

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

Reproduce

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