Average Error: 33.0 → 3.5
Time: 25.9s
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(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\sqrt[3]{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \sqrt[3]{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\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(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), \left(\sqrt[3]{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \sqrt[3]{y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}}\right)\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 r1031123 = x_re;
        double r1031124 = r1031123 * r1031123;
        double r1031125 = x_im;
        double r1031126 = r1031125 * r1031125;
        double r1031127 = r1031124 + r1031126;
        double r1031128 = sqrt(r1031127);
        double r1031129 = log(r1031128);
        double r1031130 = y_re;
        double r1031131 = r1031129 * r1031130;
        double r1031132 = atan2(r1031125, r1031123);
        double r1031133 = y_im;
        double r1031134 = r1031132 * r1031133;
        double r1031135 = r1031131 - r1031134;
        double r1031136 = exp(r1031135);
        double r1031137 = r1031129 * r1031133;
        double r1031138 = r1031132 * r1031130;
        double r1031139 = r1031137 + r1031138;
        double r1031140 = sin(r1031139);
        double r1031141 = r1031136 * r1031140;
        return r1031141;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1031142 = y_im;
        double r1031143 = x_re;
        double r1031144 = x_im;
        double r1031145 = hypot(r1031143, r1031144);
        double r1031146 = log(r1031145);
        double r1031147 = y_re;
        double r1031148 = atan2(r1031144, r1031143);
        double r1031149 = r1031147 * r1031148;
        double r1031150 = cbrt(r1031149);
        double r1031151 = r1031150 * r1031150;
        double r1031152 = r1031151 * r1031150;
        double r1031153 = fma(r1031142, r1031146, r1031152);
        double r1031154 = sin(r1031153);
        double r1031155 = log1p(r1031154);
        double r1031156 = expm1(r1031155);
        double r1031157 = expm1(r1031156);
        double r1031158 = log1p(r1031157);
        double r1031159 = r1031146 * r1031147;
        double r1031160 = r1031142 * r1031148;
        double r1031161 = r1031159 - r1031160;
        double r1031162 = exp(r1031161);
        double r1031163 = r1031158 * r1031162;
        return r1031163;
}

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

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

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

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