Average Error: 32.9 → 3.5
Time: 30.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)\]
\[\frac{\log \left(e^{\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)}{e^{\left(y.im \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\]
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)
\frac{\log \left(e^{\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)}{e^{\left(y.im \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1232191 = x_re;
        double r1232192 = r1232191 * r1232191;
        double r1232193 = x_im;
        double r1232194 = r1232193 * r1232193;
        double r1232195 = r1232192 + r1232194;
        double r1232196 = sqrt(r1232195);
        double r1232197 = log(r1232196);
        double r1232198 = y_re;
        double r1232199 = r1232197 * r1232198;
        double r1232200 = atan2(r1232193, r1232191);
        double r1232201 = y_im;
        double r1232202 = r1232200 * r1232201;
        double r1232203 = r1232199 - r1232202;
        double r1232204 = exp(r1232203);
        double r1232205 = r1232197 * r1232201;
        double r1232206 = r1232200 * r1232198;
        double r1232207 = r1232205 + r1232206;
        double r1232208 = cos(r1232207);
        double r1232209 = r1232204 * r1232208;
        return r1232209;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1232210 = y_im;
        double r1232211 = x_re;
        double r1232212 = x_im;
        double r1232213 = hypot(r1232211, r1232212);
        double r1232214 = log(r1232213);
        double r1232215 = atan2(r1232212, r1232211);
        double r1232216 = y_re;
        double r1232217 = r1232215 * r1232216;
        double r1232218 = fma(r1232210, r1232214, r1232217);
        double r1232219 = cos(r1232218);
        double r1232220 = exp(r1232219);
        double r1232221 = log(r1232220);
        double r1232222 = cbrt(r1232215);
        double r1232223 = cbrt(r1232222);
        double r1232224 = r1232223 * r1232223;
        double r1232225 = r1232224 * r1232223;
        double r1232226 = r1232210 * r1232225;
        double r1232227 = r1232222 * r1232222;
        double r1232228 = r1232226 * r1232227;
        double r1232229 = r1232216 * r1232214;
        double r1232230 = r1232228 - r1232229;
        double r1232231 = exp(r1232230);
        double r1232232 = r1232221 / r1232231;
        return r1232232;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 32.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)\]
  2. Simplified3.5

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

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

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

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

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

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

Reproduce

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