Average Error: 32.5 → 3.4
Time: 31.3s
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)\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right) \cdot e^{\left(\left(y.re + y.re\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\]
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)
\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right) \cdot e^{\left(\left(y.re + y.re\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r605011 = x_re;
        double r605012 = r605011 * r605011;
        double r605013 = x_im;
        double r605014 = r605013 * r605013;
        double r605015 = r605012 + r605014;
        double r605016 = sqrt(r605015);
        double r605017 = log(r605016);
        double r605018 = y_re;
        double r605019 = r605017 * r605018;
        double r605020 = atan2(r605013, r605011);
        double r605021 = y_im;
        double r605022 = r605020 * r605021;
        double r605023 = r605019 - r605022;
        double r605024 = exp(r605023);
        double r605025 = r605017 * r605021;
        double r605026 = r605020 * r605018;
        double r605027 = r605025 + r605026;
        double r605028 = cos(r605027);
        double r605029 = r605024 * r605028;
        return r605029;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r605030 = y_im;
        double r605031 = x_re;
        double r605032 = x_im;
        double r605033 = hypot(r605031, r605032);
        double r605034 = log(r605033);
        double r605035 = y_re;
        double r605036 = atan2(r605032, r605031);
        double r605037 = r605035 * r605036;
        double r605038 = fma(r605030, r605034, r605037);
        double r605039 = cos(r605038);
        double r605040 = expm1(r605039);
        double r605041 = log1p(r605040);
        double r605042 = r605035 + r605035;
        double r605043 = cbrt(r605033);
        double r605044 = log(r605043);
        double r605045 = r605042 * r605044;
        double r605046 = r605044 * r605035;
        double r605047 = r605045 + r605046;
        double r605048 = r605036 * r605030;
        double r605049 = r605047 - r605048;
        double r605050 = exp(r605049);
        double r605051 = r605041 * r605050;
        return r605051;
}

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

    \[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.4

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

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

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

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

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

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

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right) \cdot e^{\left(\left(y.re + y.re\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\]

Reproduce

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