Average Error: 33.0 → 3.2
Time: 28.7s
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(\log \left(e^{\sqrt[3]{\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) \cdot \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 \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)\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\]
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(\log \left(e^{\sqrt[3]{\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) \cdot \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 \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)\right) \cdot e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1320843 = x_re;
        double r1320844 = r1320843 * r1320843;
        double r1320845 = x_im;
        double r1320846 = r1320845 * r1320845;
        double r1320847 = r1320844 + r1320846;
        double r1320848 = sqrt(r1320847);
        double r1320849 = log(r1320848);
        double r1320850 = y_re;
        double r1320851 = r1320849 * r1320850;
        double r1320852 = atan2(r1320845, r1320843);
        double r1320853 = y_im;
        double r1320854 = r1320852 * r1320853;
        double r1320855 = r1320851 - r1320854;
        double r1320856 = exp(r1320855);
        double r1320857 = r1320849 * r1320853;
        double r1320858 = r1320852 * r1320850;
        double r1320859 = r1320857 + r1320858;
        double r1320860 = cos(r1320859);
        double r1320861 = r1320856 * r1320860;
        return r1320861;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1320862 = y_im;
        double r1320863 = x_re;
        double r1320864 = x_im;
        double r1320865 = hypot(r1320863, r1320864);
        double r1320866 = log(r1320865);
        double r1320867 = y_re;
        double r1320868 = atan2(r1320864, r1320863);
        double r1320869 = r1320867 * r1320868;
        double r1320870 = fma(r1320862, r1320866, r1320869);
        double r1320871 = cos(r1320870);
        double r1320872 = expm1(r1320871);
        double r1320873 = r1320872 * r1320872;
        double r1320874 = r1320873 * r1320872;
        double r1320875 = cbrt(r1320874);
        double r1320876 = exp(r1320875);
        double r1320877 = log(r1320876);
        double r1320878 = log1p(r1320877);
        double r1320879 = r1320866 * r1320867;
        double r1320880 = r1320862 * r1320868;
        double r1320881 = r1320879 - r1320880;
        double r1320882 = exp(r1320881);
        double r1320883 = r1320878 * r1320882;
        return r1320883;
}

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. Simplified3.2

    \[\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 log1p-expm1-u3.2

    \[\leadsto 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 \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)}\]
  5. Using strategy rm
  6. Applied add-log-exp3.2

    \[\leadsto 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 \mathsf{log1p}\left(\color{blue}{\log \left(e^{\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)}\right)\]
  7. Using strategy rm
  8. Applied add-cbrt-cube3.2

    \[\leadsto 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 \mathsf{log1p}\left(\log \left(e^{\color{blue}{\sqrt[3]{\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) \cdot \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) \cdot \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)\right)\]
  9. Final simplification3.2

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

Reproduce

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