Average Error: 33.2 → 3.3
Time: 23.4s
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)\]
\[e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \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)\right) \cdot y.im\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right)} \cdot \mathsf{expm1}\left(\mathsf{log1p}\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)\]
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)
e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \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)\right) \cdot y.im\right) \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right)} \cdot \mathsf{expm1}\left(\mathsf{log1p}\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)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1189024 = x_re;
        double r1189025 = r1189024 * r1189024;
        double r1189026 = x_im;
        double r1189027 = r1189026 * r1189026;
        double r1189028 = r1189025 + r1189027;
        double r1189029 = sqrt(r1189028);
        double r1189030 = log(r1189029);
        double r1189031 = y_re;
        double r1189032 = r1189030 * r1189031;
        double r1189033 = atan2(r1189026, r1189024);
        double r1189034 = y_im;
        double r1189035 = r1189033 * r1189034;
        double r1189036 = r1189032 - r1189035;
        double r1189037 = exp(r1189036);
        double r1189038 = r1189030 * r1189034;
        double r1189039 = r1189033 * r1189031;
        double r1189040 = r1189038 + r1189039;
        double r1189041 = cos(r1189040);
        double r1189042 = r1189037 * r1189041;
        return r1189042;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1189043 = x_re;
        double r1189044 = x_im;
        double r1189045 = hypot(r1189043, r1189044);
        double r1189046 = log(r1189045);
        double r1189047 = y_re;
        double r1189048 = r1189046 * r1189047;
        double r1189049 = atan2(r1189044, r1189043);
        double r1189050 = cbrt(r1189049);
        double r1189051 = cbrt(r1189050);
        double r1189052 = r1189051 * r1189051;
        double r1189053 = r1189051 * r1189052;
        double r1189054 = y_im;
        double r1189055 = r1189053 * r1189054;
        double r1189056 = r1189050 * r1189050;
        double r1189057 = r1189055 * r1189056;
        double r1189058 = r1189048 - r1189057;
        double r1189059 = exp(r1189058);
        double r1189060 = r1189047 * r1189049;
        double r1189061 = fma(r1189054, r1189046, r1189060);
        double r1189062 = cos(r1189061);
        double r1189063 = log1p(r1189062);
        double r1189064 = expm1(r1189063);
        double r1189065 = r1189059 * r1189064;
        return r1189065;
}

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 33.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. Simplified3.3

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

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \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} \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 associate-*l*3.3

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

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \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)} \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 expm1-log1p-u3.3

    \[\leadsto e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \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)} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\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.3

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

Reproduce

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