Average Error: 33.0 → 3.4
Time: 15.1s
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(\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^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right) \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\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 \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(\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^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right) \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\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 r15849 = x_re;
        double r15850 = r15849 * r15849;
        double r15851 = x_im;
        double r15852 = r15851 * r15851;
        double r15853 = r15850 + r15852;
        double r15854 = sqrt(r15853);
        double r15855 = log(r15854);
        double r15856 = y_re;
        double r15857 = r15855 * r15856;
        double r15858 = atan2(r15851, r15849);
        double r15859 = y_im;
        double r15860 = r15858 * r15859;
        double r15861 = r15857 - r15860;
        double r15862 = exp(r15861);
        double r15863 = r15855 * r15859;
        double r15864 = r15858 * r15856;
        double r15865 = r15863 + r15864;
        double r15866 = sin(r15865);
        double r15867 = r15862 * r15866;
        return r15867;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r15868 = x_re;
        double r15869 = x_im;
        double r15870 = hypot(r15868, r15869);
        double r15871 = log(r15870);
        double r15872 = y_im;
        double r15873 = atan2(r15869, r15868);
        double r15874 = y_re;
        double r15875 = r15873 * r15874;
        double r15876 = fma(r15871, r15872, r15875);
        double r15877 = sin(r15876);
        double r15878 = expm1(r15877);
        double r15879 = log1p(r15878);
        double r15880 = r15871 * r15874;
        double r15881 = r15873 * r15872;
        double r15882 = cbrt(r15881);
        double r15883 = r15882 * r15882;
        double r15884 = cbrt(r15882);
        double r15885 = r15884 * r15884;
        double r15886 = r15885 * r15884;
        double r15887 = r15883 * r15886;
        double r15888 = r15880 - r15887;
        double r15889 = exp(r15888);
        double r15890 = r15879 * r15889;
        return r15890;
}

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

    \[\leadsto \color{blue}{\sin \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 \sin \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 \sin \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 \sin \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. Using strategy rm
  8. Applied add-cube-cbrt3.4

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

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

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

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

Reproduce

herbie shell --seed 2019350 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  :precision binary64
  (* (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)))))