Average Error: 33.0 → 3.4
Time: 31.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)\]
\[\mathsf{expm1}\left(\sqrt[3]{\sqrt[3]{{\left({\left(\mathsf{log1p}\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)\right)}^{3}\right)}^{3}}}\right) \cdot e^{\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\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)
\mathsf{expm1}\left(\sqrt[3]{\sqrt[3]{{\left({\left(\mathsf{log1p}\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)\right)}^{3}\right)}^{3}}}\right) \cdot e^{\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r25063 = x_re;
        double r25064 = r25063 * r25063;
        double r25065 = x_im;
        double r25066 = r25065 * r25065;
        double r25067 = r25064 + r25066;
        double r25068 = sqrt(r25067);
        double r25069 = log(r25068);
        double r25070 = y_re;
        double r25071 = r25069 * r25070;
        double r25072 = atan2(r25065, r25063);
        double r25073 = y_im;
        double r25074 = r25072 * r25073;
        double r25075 = r25071 - r25074;
        double r25076 = exp(r25075);
        double r25077 = r25069 * r25073;
        double r25078 = r25072 * r25070;
        double r25079 = r25077 + r25078;
        double r25080 = cos(r25079);
        double r25081 = r25076 * r25080;
        return r25081;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r25082 = x_re;
        double r25083 = x_im;
        double r25084 = hypot(r25082, r25083);
        double r25085 = log(r25084);
        double r25086 = y_im;
        double r25087 = atan2(r25083, r25082);
        double r25088 = y_re;
        double r25089 = r25087 * r25088;
        double r25090 = fma(r25085, r25086, r25089);
        double r25091 = cos(r25090);
        double r25092 = log1p(r25091);
        double r25093 = 3.0;
        double r25094 = pow(r25092, r25093);
        double r25095 = pow(r25094, r25093);
        double r25096 = cbrt(r25095);
        double r25097 = cbrt(r25096);
        double r25098 = expm1(r25097);
        double r25099 = r25087 * r25086;
        double r25100 = -r25099;
        double r25101 = fma(r25088, r25085, r25100);
        double r25102 = exp(r25101);
        double r25103 = r25098 * r25102;
        return r25103;
}

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

    \[\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 add-exp-log8.5

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

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

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

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

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

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

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

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

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

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

Reproduce

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