Average Error: 32.8 → 3.7
Time: 37.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 \sin \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(\sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \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 \sin \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(\sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \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 r1001765 = x_re;
        double r1001766 = r1001765 * r1001765;
        double r1001767 = x_im;
        double r1001768 = r1001767 * r1001767;
        double r1001769 = r1001766 + r1001768;
        double r1001770 = sqrt(r1001769);
        double r1001771 = log(r1001770);
        double r1001772 = y_re;
        double r1001773 = r1001771 * r1001772;
        double r1001774 = atan2(r1001767, r1001765);
        double r1001775 = y_im;
        double r1001776 = r1001774 * r1001775;
        double r1001777 = r1001773 - r1001776;
        double r1001778 = exp(r1001777);
        double r1001779 = r1001771 * r1001775;
        double r1001780 = r1001774 * r1001772;
        double r1001781 = r1001779 + r1001780;
        double r1001782 = sin(r1001781);
        double r1001783 = r1001778 * r1001782;
        return r1001783;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1001784 = y_im;
        double r1001785 = x_re;
        double r1001786 = x_im;
        double r1001787 = hypot(r1001785, r1001786);
        double r1001788 = log(r1001787);
        double r1001789 = y_re;
        double r1001790 = cbrt(r1001789);
        double r1001791 = r1001790 * r1001790;
        double r1001792 = atan2(r1001786, r1001785);
        double r1001793 = r1001791 * r1001792;
        double r1001794 = r1001790 * r1001793;
        double r1001795 = fma(r1001784, r1001788, r1001794);
        double r1001796 = sin(r1001795);
        double r1001797 = expm1(r1001796);
        double r1001798 = log1p(r1001797);
        double r1001799 = r1001788 * r1001789;
        double r1001800 = r1001784 * r1001792;
        double r1001801 = r1001799 - r1001800;
        double r1001802 = exp(r1001801);
        double r1001803 = r1001798 * r1001802;
        return r1001803;
}

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

    \[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 \sin \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}{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 \sin \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.5

    \[\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(\sin \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-cube-cbrt3.7

    \[\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(\mathsf{expm1}\left(\sin \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 \color{blue}{\left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \sqrt[3]{y.re}\right)}\right)\right)\right)\right)\]
  7. Applied associate-*r*3.7

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

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \sqrt[3]{y.re} \cdot \left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \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 2019152 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))